Closed
Description
Konstantin Khrapchenko opened SPR-5332 and commented
Under some circumstances a JMS Exception may have a message unassigned i.e. its getMessage() returns null.
Like in #9948 that fixed JmsUtils.buildExceptionMessage I can propose a fix like
public String getMessage() {
String message = super.getMessage();
Throwable cause = getCause();
if (cause instanceof JMSException) {
Exception linkedEx = ((JMSException) cause).getLinkedException();
if (linkedEx != null && (cause.getMessage() != null && cause.getMessage().indexOf(linkedEx.getMessage()) == -1 || cause.getMessage() == null)) {
message = message + "; nested exception is " + linkedEx;
}
}
return message;
}
Affects: 2.5.6
Issue Links:
- JmsUtils.buildExceptionMessage throws NPE if the linked exception doesn't have a message [SPR-5275] #9948 JmsUtils.buildExceptionMessage throws NPE if the linked exception doesn't have a message ("duplicates")