Skip to content

Commit

Permalink
feat(irs-api):[#256] spotbug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-psosnowski committed Dec 6, 2023
1 parent 6b8e0db commit d9d43af
Showing 1 changed file with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,21 @@ public EndpointDataReferenceStatus getEndpointDataReference(final String assetId
final Optional<EndpointDataReference> endpointDataReferenceOptional = retrieveEndpointEndpointReferenceByAssetId(
assetId);

if (endpointDataReferenceOptional.isPresent() && endpointDataReferenceOptional.get().getAuthCode() != null) {
final EndpointDataReference endpointDataReference = endpointDataReferenceOptional.get();
if (isTokenExpired(endpointDataReferenceOptional.get().getAuthCode())) {
log.info("Endpoint data reference with expired token and id: {} for assetId: {} found in storage.",
endpointDataReference.getId(), assetId);
return new EndpointDataReferenceStatus(endpointDataReference,
EndpointDataReferenceStatus.TokenStatus.EXPIRED);
} else {
log.info("Endpoint data reference with id: {} for assetId: {} found in storage.",
endpointDataReference.getId(), assetId);
return new EndpointDataReferenceStatus(endpointDataReference,
EndpointDataReferenceStatus.TokenStatus.VALID);
if (endpointDataReferenceOptional.isPresent()) {
final String authCode = endpointDataReferenceOptional.get().getAuthCode();
if (authCode != null) {
final EndpointDataReference endpointDataReference = endpointDataReferenceOptional.get();
if (isTokenExpired(authCode)) {
log.info("Endpoint data reference with expired token and id: {} for assetId: {} found in storage.",
endpointDataReference.getId(), assetId);
return new EndpointDataReferenceStatus(endpointDataReference,
EndpointDataReferenceStatus.TokenStatus.EXPIRED);
} else {
log.info("Endpoint data reference with id: {} for assetId: {} found in storage.",
endpointDataReference.getId(), assetId);
return new EndpointDataReferenceStatus(endpointDataReference,
EndpointDataReferenceStatus.TokenStatus.VALID);
}
}
}

Expand Down

0 comments on commit d9d43af

Please sign in to comment.