diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java index fd2f2ac78f..69e42718f5 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/ContractNegotiationService.java @@ -91,7 +91,7 @@ public NegotiationResponse negotiate(final String providerConnectorUrl, final Ca } case EXPIRED -> { contractAgreementId = EDRAuthCode.fromAuthCodeToken( - endpointDataReferenceStatus.endpointDataReference().getAuthKey()).getCid(); + Objects.requireNonNull(endpointDataReferenceStatus.endpointDataReference().getAuthKey())).getCid(); log.info( "Cached endpoint data reference has expired token. Refreshing token without new contract negotiation for contractAgreementId: {}", contractAgreementId); diff --git a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheService.java b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheService.java index e521ef401e..e1237781cc 100644 --- a/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheService.java +++ b/irs-edc-client/src/main/java/org/eclipse/tractusx/irs/edc/client/util/EndpointDataReferenceCacheService.java @@ -24,6 +24,7 @@ package org.eclipse.tractusx.irs.edc.client.util; import java.time.Instant; +import java.util.Objects; import java.util.Optional; import lombok.AllArgsConstructor; @@ -78,7 +79,7 @@ private Optional retrieveEndpointEndpointReferenceByAsset } private static boolean isTokenExpired(final EndpointDataReference endpointDataReference) { - final Instant tokenExpirationInstant = extractTokenExpiration(endpointDataReference.getAuthCode()); + final Instant tokenExpirationInstant = extractTokenExpiration(Objects.requireNonNull(endpointDataReference.getAuthCode())); return Instant.now().isAfter(tokenExpirationInstant); }