From 262a5596d9300b7aded14d550cf8f5ee80d7ac0f Mon Sep 17 00:00:00 2001 From: James Strachan Date: Tue, 13 Dec 2005 16:18:23 +0000 Subject: [PATCH] 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 --- .../main/java/org/activemq/util/JMSExceptionSupport.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activemq-core/src/main/java/org/activemq/util/JMSExceptionSupport.java b/activemq-core/src/main/java/org/activemq/util/JMSExceptionSupport.java index ffad5c1be6..559b888604 100755 --- a/activemq-core/src/main/java/org/activemq/util/JMSExceptionSupport.java +++ b/activemq-core/src/main/java/org/activemq/util/JMSExceptionSupport.java @@ -38,6 +38,9 @@ final public class JMSExceptionSupport { } public static JMSException create(Throwable cause) { + if (cause instanceof JMSException) { + return (JMSException) cause; + } String msg = cause.getMessage(); if( msg==null || msg.length()==0 ) msg = cause.toString(); @@ -47,6 +50,9 @@ final public class JMSExceptionSupport { } public static JMSException create(Exception cause) { + if (cause instanceof JMSException) { + return (JMSException) cause; + } String msg = cause.getMessage(); if( msg==null || msg.length()==0 ) msg = cause.toString();