[AMQ-7347] Fix potential NPE when JMSException doesn't contain linkedException

This commit is contained in:
jbonofre 2020-03-10 06:23:27 +01:00
parent 4a4880301f
commit 58f5fdb572
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());
} else {
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 {
LOG.warn("Exception occurred for client {} ({}) processing: {} -> {}", connectionInfo.getClientId(), connectionInfo.getClientIp(), safeGetAction(command), exception.toString());
}