Reduce log output for entity not found in AmqpAuthenticationMessageHandler (#929)

* Reduce log output for entity not found in AmqpAuthenticationMessageHandler

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Adapt tests for reduced log message

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Suppress sonar warning + change log level for EntityNotFound

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>
This commit is contained in:
Sebastian Firsching
2020-02-18 11:29:41 +01:00
committed by GitHub
parent b5f46b8b5d
commit 87eadf59cd
2 changed files with 17 additions and 14 deletions

View File

@@ -193,6 +193,9 @@ public class AmqpAuthenticationMessageHandler extends BaseAmqpService {
return artifact;
}
// suppress warning, EntityNotFoundException has not to be logged or
// rethrown as the exception has no valuable information
@SuppressWarnings("squid:S1166")
private Message handleAuthenticationMessage(final Message message) {
final DmfDownloadResponse authenticationResponse = new DmfDownloadResponse();
final DmfTenantSecurityToken secruityToken = convertMessage(message, DmfTenantSecurityToken.class);
@@ -226,8 +229,8 @@ public class AmqpAuthenticationMessageHandler extends BaseAmqpService {
authenticationResponse.setResponseCode(HttpStatus.INTERNAL_SERVER_ERROR.value());
authenticationResponse.setMessage("Building download URI failed");
} catch (final EntityNotFoundException e) {
final String errorMessage = "Artifact for resource " + fileResource + "not found ";
LOG.warn(errorMessage, e);
final String errorMessage = "Artifact for resource " + fileResource + " not found ";
LOG.info(errorMessage);
authenticationResponse.setResponseCode(HttpStatus.NOT_FOUND.value());
authenticationResponse.setMessage(errorMessage);
}