optimisation; if a JMS exception has already been thrown then don't wrap it again

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@356519 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2005-12-13 16:18:23 +00:00
parent ab8f458612
commit 262a5596d9
1 changed files with 6 additions and 0 deletions

View File

@ -38,6 +38,9 @@ final public class JMSExceptionSupport {
} }
public static JMSException create(Throwable cause) { public static JMSException create(Throwable cause) {
if (cause instanceof JMSException) {
return (JMSException) cause;
}
String msg = cause.getMessage(); String msg = cause.getMessage();
if( msg==null || msg.length()==0 ) if( msg==null || msg.length()==0 )
msg = cause.toString(); msg = cause.toString();
@ -47,6 +50,9 @@ final public class JMSExceptionSupport {
} }
public static JMSException create(Exception cause) { public static JMSException create(Exception cause) {
if (cause instanceof JMSException) {
return (JMSException) cause;
}
String msg = cause.getMessage(); String msg = cause.getMessage();
if( msg==null || msg.length()==0 ) if( msg==null || msg.length()==0 )
msg = cause.toString(); msg = cause.toString();