Merge pull request #506 from jbonofre/AMQ-7347

[AMQ-7347] Fix potential NPE when JMSException doesn't contain linkedException
This commit is contained in:
Jean-Baptiste Onofré 2020-03-10 07:20:19 +01:00 committed by GitHub
commit 80b92d3ae9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -258,7 +258,12 @@ public class ProtocolConverter {
LOG.warn("Exception occurred while processing a command: {}", exception.toString()); LOG.warn("Exception occurred while processing a command: {}", exception.toString());
} else { } else {
if (exception instanceof JMSException) { if (exception instanceof JMSException) {
LOG.warn("Exception occurred for client {} ({}) processing: {} -> {} ({})", connectionInfo.getClientId(), connectionInfo.getClientIp(), safeGetAction(command), exception.toString(), ((JMSException) exception).getLinkedException().toString()); JMSException jmsException = (JMSException) exception;
if (jmsException.getLinkedException() != null) {
LOG.warn("Exception occurred for client {} ({}) processing: {} -> {} ({})", connectionInfo.getClientId(), connectionInfo.getClientIp(), safeGetAction(command), exception.toString(), jmsException.getLinkedException().toString());
} else {
LOG.warn("Exception occurred for client {} ({}) processing: {} -> {}", connectionInfo.getClientId(), connectionInfo.getClientIp(), safeGetAction(command), exception.toString());
}
} else { } else {
LOG.warn("Exception occurred for client {} ({}) processing: {} -> {}", connectionInfo.getClientId(), connectionInfo.getClientIp(), safeGetAction(command), exception.toString()); LOG.warn("Exception occurred for client {} ({}) processing: {} -> {}", connectionInfo.getClientId(), connectionInfo.getClientIp(), safeGetAction(command), exception.toString());
} }