[jboss-cvs] JBossAS SVN: r58214 - branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Nov 8 17:27:05 EST 2006


Author: weston.price at jboss.com
Date: 2006-11-08 17:27:04 -0500 (Wed, 08 Nov 2006)
New Revision: 58214

Added:
   branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java
Log:
[JBAS-3511] More ASF improvements.

Added: branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java	2006-11-08 22:26:46 UTC (rev 58213)
+++ branches/JBoss_4_0_3_SP1_JBAS_3511/server/src/main/org/jboss/jms/asf/WebSphereMQExceptionSorter.java	2006-11-08 22:27:04 UTC (rev 58214)
@@ -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;
+
+/**
+ * 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