[Jboss-cvs] JBossAS SVN: r54952 - trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 31 18:24:25 EDT 2006


Author: weston.price at jboss.com
Date: 2006-07-31 18:24:24 -0400 (Mon, 31 Jul 2006)
New Revision: 54952

Modified:
   trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/OracleExceptionSorter.java
Log:
Forward ported exception sorter changes from 4.0.x. Cleanup, formatting.

Modified: trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/OracleExceptionSorter.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/OracleExceptionSorter.java	2006-07-31 22:21:08 UTC (rev 54951)
+++ trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/OracleExceptionSorter.java	2006-07-31 22:24:24 UTC (rev 54952)
@@ -34,6 +34,7 @@
  *
  * @author <a href="mailto:an_test at mail.ru">Andrey Demchenko</a>
  * @author <a href="mailto:d_jencks at users.sourceforge.net">David Jencks</a>
+ * @author <a href="mailto:weston.price at jboss.com>Weston Price</a>
  * @version 1.0
  */
 public class OracleExceptionSorter implements ExceptionSorter, Serializable
@@ -42,36 +43,47 @@
 
    public OracleExceptionSorter()
    {
+   } 
 
-   } // OracleExceptionSorter constructor
-
-   public boolean isExceptionFatal(SQLException e)
+   public boolean isExceptionFatal(final SQLException e)
    {
+       final int error_code = Math.abs( e.getErrorCode() );  // I can't remember if the errors are negative or positive.
 
-      String error_text = (e.getMessage()).toUpperCase();
+       if( ( error_code == 28 )      //session has been killed
+        || ( error_code == 600 )     //Internal oracle error
+        || ( error_code == 1012 )    //not logged on
+        || ( error_code == 1014 )    //Oracle shutdown in progress
+        || ( error_code == 1033 )    //Oracle initialization or shutdown in progress
+        || ( error_code == 1034 )    //Oracle not available
+        || ( error_code == 1035 )    //ORACLE only available to users with RESTRICTED SESSION privilege
+        || ( error_code == 1089 )    //immediate shutdown in progress - no operations are permitted
+        || ( error_code == 1090 )    //shutdown in progress - connection is not permitted
+        || ( error_code == 1092 )    //ORACLE instance terminated. Disconnection forced
+        || ( error_code == 1094 )    //ALTER DATABASE CLOSE in progress. Connections not permitted
+        || ( error_code == 2396 )    //exceeded maximum idle time, please connect again
+        || ( error_code == 3106 )    //fatal two-task communication protocol error
+        || ( error_code == 3111 )    //break received on communication channel
+        || ( error_code == 3113 )    //end-of-file on communication channel
+        || ( error_code == 3114 )    //not connected to ORACLE
+        || ( error_code >= 12100 && error_code <= 12299 ) )   // TNS issues
+       {
+           return true;
+       }
 
-      /* Check oracle specific errors for broadcasting connectionerror
-      */
-      return (error_text.indexOf("ORA-00600") > -1) //Internal oracle error
-         || (error_text.indexOf("ORA-00028") > -1)  //session has been killed
-	      || (error_text.indexOf("ORA-01012") > -1)  //not logged on
-         || (error_text.indexOf("ORA-01014") > -1)  //Oracle shutdown in progress
-         || (error_text.indexOf("ORA-01033") > -1)  //Oracle initialization or shutdown in progress
-         || (error_text.indexOf("ORA-01034") > -1)  //Oracle not available
-	      || (error_text.indexOf("ORA-02396") > -1)  //exceed ed maximum idle time, please connect again
-         || (error_text.indexOf("ORA-03111") > -1)  //break received on communication channel
-         || (error_text.indexOf("ORA-03113") > -1)  //end-of-file on communication channel
-         || (error_text.indexOf("ORA-03114") > -1)  //not connected to ORACLE
-	      || (error_text.indexOf("ORA-01014") > -1)  //Oracle shutdown in progress
-         || (error_text.indexOf("ORA-01033") > -1)  //Oracle initialization or shutdown in progress
-         || (error_text.indexOf("ORA-01034") > -1)  //Oracle not available
-         || (error_text.indexOf("ORA-03111") > -1)  //break received on communication channel
-         || (error_text.indexOf("ORA-03113") > -1)  //end-of-file on communication channel
-         || (error_text.indexOf("ORA-03114") > -1)  //not connected to ORACLE
-         || (error_text.indexOf("TNS-") > -1)       //Net8 messages
-         || (error_text.indexOf("SOCKET") > -1)     //for control socket error
-         || (error_text.indexOf("BROKEN PIPE") > -1);
+       final String error_text = (e.getMessage()).toUpperCase();
 
+       // Exclude oracle user defined error codes (20000 through 20999) from consideration when looking for
+       // certain strings.
+
+       if( ( error_code < 20000 || error_code >= 21000 ) &&
+             (  (error_text.indexOf("SOCKET") > -1)     //for control socket error
+             || (error_text.indexOf("CONNECTION HAS ALREADY BEEN CLOSED") > -1)
+             || (error_text.indexOf("BROKEN PIPE") > -1) ) )
+       {
+           return true;
+       }
+
+       return false;
    }
 
-} // OracleExceptionSorter
+} 




More information about the jboss-cvs-commits mailing list