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:
committed by
GitHub
parent
b5f46b8b5d
commit
87eadf59cd
@@ -193,6 +193,9 @@ public class AmqpAuthenticationMessageHandler extends BaseAmqpService {
|
|||||||
return artifact;
|
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) {
|
private Message handleAuthenticationMessage(final Message message) {
|
||||||
final DmfDownloadResponse authenticationResponse = new DmfDownloadResponse();
|
final DmfDownloadResponse authenticationResponse = new DmfDownloadResponse();
|
||||||
final DmfTenantSecurityToken secruityToken = convertMessage(message, DmfTenantSecurityToken.class);
|
final DmfTenantSecurityToken secruityToken = convertMessage(message, DmfTenantSecurityToken.class);
|
||||||
@@ -227,7 +230,7 @@ public class AmqpAuthenticationMessageHandler extends BaseAmqpService {
|
|||||||
authenticationResponse.setMessage("Building download URI failed");
|
authenticationResponse.setMessage("Building download URI failed");
|
||||||
} catch (final EntityNotFoundException e) {
|
} catch (final EntityNotFoundException e) {
|
||||||
final String errorMessage = "Artifact for resource " + fileResource + " not found ";
|
final String errorMessage = "Artifact for resource " + fileResource + " not found ";
|
||||||
LOG.warn(errorMessage, e);
|
LOG.info(errorMessage);
|
||||||
authenticationResponse.setResponseCode(HttpStatus.NOT_FOUND.value());
|
authenticationResponse.setResponseCode(HttpStatus.NOT_FOUND.value());
|
||||||
authenticationResponse.setMessage(errorMessage);
|
authenticationResponse.setMessage(errorMessage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ public class AmqpAuthenticationMessageHandlerIntegrationTest extends AbstractAmq
|
|||||||
FileResource.createFileResourceBySha1(sha1Hash));
|
FileResource.createFileResourceBySha1(sha1Hash));
|
||||||
|
|
||||||
final Message returnMessage = sendAndReceiveAuthenticationMessage(securityToken);
|
final Message returnMessage = sendAndReceiveAuthenticationMessage(securityToken);
|
||||||
verifyResult(returnMessage, HttpStatus.NOT_FOUND,
|
verifyResult(returnMessage, HttpStatus.NOT_FOUND, "Artifact for resource FileResource [sha1=" + sha1Hash
|
||||||
"Artifact for resource FileResource [sha1=" + sha1Hash + ", artifactId=null, filename=null]not found ");
|
+ ", artifactId=null, filename=null] not found ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -159,8 +159,8 @@ public class AmqpAuthenticationMessageHandlerIntegrationTest extends AbstractAmq
|
|||||||
FileResource.createFileResourceBySha1(sha1Hash));
|
FileResource.createFileResourceBySha1(sha1Hash));
|
||||||
|
|
||||||
final Message returnMessage = sendAndReceiveAuthenticationMessage(securityToken);
|
final Message returnMessage = sendAndReceiveAuthenticationMessage(securityToken);
|
||||||
verifyResult(returnMessage, HttpStatus.NOT_FOUND,
|
verifyResult(returnMessage, HttpStatus.NOT_FOUND, "Artifact for resource FileResource [sha1=" + sha1Hash
|
||||||
"Artifact for resource FileResource [sha1=" + sha1Hash + ", artifactId=null, filename=null]not found ");
|
+ ", artifactId=null, filename=null] not found ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user