Fix new Sonar reports

This commit is contained in:
Gary Russell
2018-11-11 14:36:49 -05:00
committed by Artem Bilan
parent 20718c05f0
commit fb5854c480
2 changed files with 8 additions and 2 deletions

View File

@@ -490,12 +490,18 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
expectedType = requestPayloadType.resolve();
}
/*
* TODO: resolve() can return null, which is not valid for canRead().
* Perhaps we should coerce to String/byte[] instead of attempting
* to convert. However this might be a breaking change - 5.2?
* Hence NOSONAR below.
*/
for (HttpMessageConverter<?> converter : this.messageConverters) {
if (converter.canRead(expectedType, contentType)) {
return converter.read((Class) expectedType, request);
}
}
throw new MessagingException(
throw new MessagingException( // NOSONAR might be null; see comment above.
"Could not convert request: no suitable HttpMessageConverter found for expected type ["
+ expectedType != null ? expectedType.getName() : "null"
+ "] and content type [" + contentType + "]");

View File

@@ -152,7 +152,7 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler
Object result;
if (this.collectionCallback != null) {
result = this.mongoTemplate.execute(collectionName, this.collectionCallback);
result = this.mongoTemplate.execute(collectionName, this.collectionCallback); // NOSONAR
}
else {
Query query = buildQuery(requestMessage);