Sonar fixes
- printStackTrace in test mail server - Illegal throws - Large anon. classes * - indexOf char - stored external object * - ignored exceptional return values * - checkstyle
This commit is contained in:
committed by
Artem Bilan
parent
4199ff57cd
commit
0bb901b286
@@ -208,37 +208,38 @@ public class StompInboundChannelAdapter extends MessageProducerSupport implement
|
||||
|
||||
private void subscribeDestination(final String destination) {
|
||||
if (this.stompSession != null) {
|
||||
class FrameHandler implements StompFrameHandler {
|
||||
|
||||
@Override
|
||||
public Type getPayloadType(StompHeaders headers) {
|
||||
return StompInboundChannelAdapter.this.payloadType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFrame(StompHeaders headers, @Nullable Object body) {
|
||||
Message<?> message;
|
||||
|
||||
if (body == null) {
|
||||
logger.info("No body in STOMP frame: nothing to produce.");
|
||||
return;
|
||||
}
|
||||
else if (body instanceof Message) {
|
||||
message = (Message<?>) body;
|
||||
}
|
||||
else {
|
||||
message =
|
||||
getMessageBuilderFactory()
|
||||
.withPayload(body)
|
||||
.copyHeaders(
|
||||
StompInboundChannelAdapter.this.headerMapper.toHeaders(headers))
|
||||
.build();
|
||||
}
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
}
|
||||
final StompSession.Subscription subscription =
|
||||
this.stompSession.subscribe(destination, new StompFrameHandler() {
|
||||
|
||||
@Override
|
||||
public Type getPayloadType(StompHeaders headers) {
|
||||
return StompInboundChannelAdapter.this.payloadType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFrame(StompHeaders headers, @Nullable Object body) {
|
||||
Message<?> message;
|
||||
|
||||
if (body == null) {
|
||||
logger.info("No body in STOMP frame: nothing to produce.");
|
||||
return;
|
||||
}
|
||||
else if (body instanceof Message) {
|
||||
message = (Message<?>) body;
|
||||
}
|
||||
else {
|
||||
message =
|
||||
getMessageBuilderFactory()
|
||||
.withPayload(body)
|
||||
.copyHeaders(
|
||||
StompInboundChannelAdapter.this.headerMapper.toHeaders(headers))
|
||||
.build();
|
||||
}
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
});
|
||||
this.stompSession.subscribe(destination, new FrameHandler());
|
||||
|
||||
if (this.stompSessionManager.isAutoReceiptEnabled()) {
|
||||
final ApplicationEventPublisher eventPublisher = this.applicationEventPublisher;
|
||||
|
||||
@@ -80,21 +80,23 @@ public class StompHeaderMapper implements HeaderMapper<StompHeaders> {
|
||||
|
||||
private String[] outboundHeaderNames = STOMP_OUTBOUND_HEADER_NAMES;
|
||||
|
||||
public void setInboundHeaderNames(String[] inboundHeaderNames) { //NOSONAR - false positive
|
||||
public void setInboundHeaderNames(String[] inboundHeaderNames) {
|
||||
Assert.notNull(inboundHeaderNames, "'inboundHeaderNames' must not be null.");
|
||||
Assert.noNullElements(inboundHeaderNames, "'inboundHeaderNames' must not contains null elements.");
|
||||
Arrays.sort(inboundHeaderNames);
|
||||
String[] copy = Arrays.copyOf(inboundHeaderNames, inboundHeaderNames.length);
|
||||
Arrays.sort(copy);
|
||||
if (!Arrays.equals(STOMP_INBOUND_HEADER_NAMES, inboundHeaderNames)) {
|
||||
this.inboundHeaderNames = inboundHeaderNames;
|
||||
this.inboundHeaderNames = copy;
|
||||
}
|
||||
}
|
||||
|
||||
public void setOutboundHeaderNames(String[] outboundHeaderNames) { //NOSONAR - false positive
|
||||
public void setOutboundHeaderNames(String[] outboundHeaderNames) {
|
||||
Assert.notNull(outboundHeaderNames, "'outboundHeaderNames' must not be null.");
|
||||
Assert.noNullElements(outboundHeaderNames, "'outboundHeaderNames' must not contains null elements.");
|
||||
Arrays.sort(outboundHeaderNames);
|
||||
String[] copy = Arrays.copyOf(outboundHeaderNames, outboundHeaderNames.length);
|
||||
Arrays.sort(copy);
|
||||
if (!Arrays.equals(STOMP_OUTBOUND_HEADER_NAMES, outboundHeaderNames)) {
|
||||
this.outboundHeaderNames = outboundHeaderNames;
|
||||
this.outboundHeaderNames = copy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user