[jboss-cvs] JBossAS SVN: r58912 - branches/JBoss_4_0_5_GA_JBAS_3657/server/src/main/org/jboss/jms/asf
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 7 17:00:21 EST 2006
Author: weston.price at jboss.com
Date: 2006-12-07 17:00:20 -0500 (Thu, 07 Dec 2006)
New Revision: 58912
Added:
branches/JBoss_4_0_5_GA_JBAS_3657/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java
Log:
[JBAS-3657][JBAS-3511] Port of patch made for client in integrating with WebSphereMQ
Added: branches/JBoss_4_0_5_GA_JBAS_3657/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java
===================================================================
--- branches/JBoss_4_0_5_GA_JBAS_3657/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java 2006-12-07 21:59:59 UTC (rev 58911)
+++ branches/JBoss_4_0_5_GA_JBAS_3657/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java 2006-12-07 22:00:20 UTC (rev 58912)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, the OpenSource J2EE webOS
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.jms.asf;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jms.JMSException;
+
+/**
+ * A WebSphereMQExceptionSorter.
+ *
+ */
+public class WebSphereMQExceptionSorter implements JMSExceptionSorter
+{
+ private static final List errorCodes = new ArrayList();
+ private boolean validateLinkedException = true;
+
+ static
+ {
+ errorCodes.add(new Integer(2009));
+ }
+
+ public boolean isJMSExceptionFatal(final JMSException e)
+ {
+
+ final String errorCode = e.getErrorCode();
+ boolean fatal = false;
+
+ if(errorCode != null)
+ {
+ for(Iterator iter = errorCodes.iterator(); iter.hasNext();)
+ {
+ final Integer code = (Integer)iter.next();
+
+ if(JMSExceptionCodeMatcher.matches(errorCode, code))
+ {
+ fatal = true;
+ break;
+ }
+ }
+
+ }
+
+ if(!fatal && validateLinkedException)
+ {
+
+ if(e.getLinkedException() instanceof JMSException)
+ {
+ final JMSException linked = (JMSException)e.getLinkedException();
+
+ if(linked != null && linked.getErrorCode() != null)
+ {
+ final String linkedCode = linked.getErrorCode();
+
+ for(Iterator iter = errorCodes.iterator(); iter.hasNext();)
+ {
+ Integer code = (Integer)iter.next();
+
+ if(JMSExceptionCodeMatcher.matches(linkedCode, code))
+ {
+ fatal = true;
+ break;
+ }
+ }
+ }
+
+ }
+
+ }
+
+ return fatal;
+ }
+
+ public boolean getValidateLinkedException()
+ {
+ return this.validateLinkedException;
+ }
+
+ public void setValidateLinkedException(boolean vle)
+ {
+ this.validateLinkedException = vle;
+
+ }
+
+}
More information about the jboss-cvs-commits
mailing list