Address Sonar reports for recent commits

This commit is contained in:
Gary Russell
2018-11-08 12:29:22 -05:00
committed by Artem Bilan
parent 648aeb8e96
commit 433ef4c4aa
4 changed files with 11 additions and 8 deletions

View File

@@ -497,7 +497,8 @@ public abstract class HttpRequestHandlingEndpointSupport extends BaseHttpInbound
}
throw new MessagingException(
"Could not convert request: no suitable HttpMessageConverter found for expected type ["
+ expectedType.getName() + "] and content type [" + contentType + "]");
+ expectedType != null ? expectedType.getName() : "null"
+ "] and content type [" + contentType + "]");
}
}

View File

@@ -148,7 +148,7 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler
protected Object handleRequestMessage(Message<?> requestMessage) {
String collectionName =
this.collectionNameExpression.getValue(this.evaluationContext, requestMessage, String.class);
// TODO: 5.2 assert not null
Object result;
if (this.collectionCallback != null) {
@@ -158,10 +158,10 @@ public class MongoDbOutboundGateway extends AbstractReplyProducingMessageHandler
Query query = buildQuery(requestMessage);
if (this.expectSingleResult) {
result = this.mongoTemplate.findOne(query, this.entityClass, collectionName);
result = this.mongoTemplate.findOne(query, this.entityClass, collectionName); // NOSONAR
}
else {
result = this.mongoTemplate.find(query, this.entityClass, collectionName);
result = this.mongoTemplate.find(query, this.entityClass, collectionName); // NOSONAR
}
}

View File

@@ -102,12 +102,13 @@ public class RedisPublishingMessageHandler extends AbstractMessageHandler {
protected void handleMessageInternal(Message<?> message) {
String topic = this.topicExpression.getValue(this.evaluationContext, message, String.class);
Object value = this.messageConverter.fromMessage(message, Object.class);
// TODO: 5.2 assert both not null
if (value instanceof byte[]) {
this.template.convertAndSend(topic, value);
this.template.convertAndSend(topic, value); // NOSONAR
}
else {
this.template.convertAndSend(topic, ((RedisSerializer<Object>) this.serializer).serialize(value));
this.template.convertAndSend(topic, ((RedisSerializer<Object>) this.serializer).serialize(value)); // NOSONAR
}
}

View File

@@ -125,11 +125,12 @@ public class RedisQueueOutboundChannelAdapter extends AbstractMessageHandler {
}
String queueName = this.queueNameExpression.getValue(this.evaluationContext, message, String.class);
// TODO: 5.2 assert both not null
if (this.leftPush) {
this.template.boundListOps(queueName).leftPush(value);
this.template.boundListOps(queueName).leftPush(value); // NOSONAR
}
else {
this.template.boundListOps(queueName).rightPush(value);
this.template.boundListOps(queueName).rightPush(value); // NOSONAR
}
}