1 16 17 package org.springframework.jms; 18 19 import javax.jms.JMSException ; 20 21 import org.springframework.core.NestedRuntimeException; 22 23 31 public abstract class JmsException extends NestedRuntimeException { 32 33 37 public JmsException(String msg) { 38 super(msg); 39 } 40 41 48 public JmsException(String msg, Throwable cause) { 49 super(msg, cause); 50 } 51 52 58 public JmsException(Throwable cause) { 59 super(cause != null ? cause.getMessage() : null, cause); 60 } 61 62 68 public String getErrorCode() { 69 if (getCause() instanceof JMSException ) { 70 return ((JMSException ) getCause()).getErrorCode(); 71 } 72 return null; 73 } 74 75 80 public String getMessage() { 81 String message = super.getMessage(); 82 Throwable cause = getCause(); 83 if (cause instanceof JMSException ) { 84 Exception linkedEx = ((JMSException ) cause).getLinkedException(); 85 if (linkedEx != null) { 86 message = message + "; nested exception is " + linkedEx; 87 } 88 } 89 return message; 90 } 91 92 } 93 | Popular Tags |