You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2007/05/24 23:21:29 UTC

svn commit: r541435 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/error/ engine/org/apache/derby/impl/jdbc/ engine/org/apache/derby/jdbc/ testing/org/apache/derbyTesting/functionTests/tests/lang/ testing/org/apache/derbyTesting/functionT...

Author: kahatlen
Date: Thu May 24 14:21:27 2007
New Revision: 541435

URL: http://svn.apache.org/viewvc?view=rev&rev=541435
Log:
DERBY-1440: jdk 1.6 client driver omits SQLStates and chained exceptions in
error messages

While working on DERBY-2472 I found out what caused this difference between
the JDBC 3.0 driver and the JDBC 4.0 driver. There are three
problems. Firstly, StandardException.unexpectedUserException() doesn't
recognize that an SQLException is generated Derby since it is not an
EmbedSQLException. Secondly, TransactionResourceImpl.wrapInSQLException()
invokes SQLException.setNextException() explicitly so that the required
chaining/ferrying logic in the exception factory and in EmbedSQLException's
constructor is not used. Thirdly,
SQLException40.wrapArgsForTransportAcrossDRDA() puts a standard
SQLException, not an EmbedSQLException, in the argument ferry's
next-exception chain, which prevents the network server from seeing it as a
Derby exception.

The attached patch fixes the problem by

  1) using SQLExceptionFactory.getArgumentFerry() to find out whether the
     exception is a Derby exception in unexpectedUserException()

  2) using factory methods instead of setNextException() to do the chaining
     in wrapInSQLException()

  3) improving Util.javaException() so that it sets up a next-exception
     chain if the Java exception contains nested exceptions

  4) changing wrapArgsForTransportAcrossDRDA() to create an argument ferry
     whose next exception is the argument ferry of the main exception's next
     exception

This patch also fixes all the JUnit tests that contain code looking like this:

    assertStatementError(JDBC.vmSupportsJDBC4() ? "38000" : "42X62", cSt);

Now, the check for JDBC level is not needed anymore for those tests.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/Util.java
    db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ProcedureInTriggerTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/error/StandardException.java Thu May 24 14:21:27 2007
@@ -24,6 +24,7 @@
 import org.apache.derby.iapi.reference.SQLState;
 
 import org.apache.derby.impl.jdbc.EmbedSQLException;
+import org.apache.derby.impl.jdbc.Util;
 import org.apache.derby.iapi.error.ExceptionSeverity;
 import org.apache.derby.iapi.services.i18n.MessageService;
 import org.apache.derby.iapi.services.sanity.SanityManager;
@@ -436,6 +437,18 @@
 
 	public static StandardException unexpectedUserException(Throwable t)
 	{
+        // If the exception is an SQLException generated by Derby, it has an
+        // argument ferry which is an EmbedSQLException. Use this to check
+        // whether the exception was generated by Derby.
+        EmbedSQLException ferry = null;
+        if (t instanceof SQLException) {
+            SQLException sqle =
+                Util.getExceptionFactory().getArgumentFerry((SQLException) t);
+            if (sqle instanceof EmbedSQLException) {
+                ferry = (EmbedSQLException) sqle;
+            }
+        }
+
 		/*
 		** If we have a SQLException that isn't an EmbedSQLException
 		** (i.e. it didn't come from Derby), then we check
@@ -443,8 +456,7 @@
 		** (38001-38XXX).  If so, then we convert it into a 
 		** StandardException without further ado.
 		*/ 
-		if ((t instanceof SQLException) &&
-		    !(t instanceof EmbedSQLException)) 
+		if ((t instanceof SQLException) && (ferry == null))
 		{
 			SQLException sqlex  = (SQLException)t;
 			String state = sqlex.getSQLState();
@@ -463,10 +475,9 @@
 		}
 
 		// Look for simple wrappers for 3.0.1 - will be cleaned up in main
-		if (t instanceof EmbedSQLException) {
-			EmbedSQLException csqle = (EmbedSQLException) t;
-			if (csqle.isSimpleWrapper()) {
-				Throwable wrapped = csqle.getCause();
+		if (ferry != null) {
+			if (ferry.isSimpleWrapper()) {
+				Throwable wrapped = ferry.getCause();
 				if (wrapped instanceof StandardException)
 					return (StandardException) wrapped;
 			}
@@ -514,8 +525,8 @@
 			String	detailMessage;
 			boolean derbyException = false;
 
-			if (t instanceof EmbedSQLException) {
-				detailMessage = ((EmbedSQLException) t).toString();
+			if (ferry != null) {
+				detailMessage = ferry.toString();
 				derbyException = true;
 			}
 			else {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Thu May 24 14:21:27 2007
@@ -4404,7 +4404,7 @@
 		// the ResultSet or the Statement. So we only need
 		// to convert the exception to a SQLException.
 
-		return TransactionResourceImpl.wrapInSQLException((SQLException) null, thrownException);
+		return TransactionResourceImpl.wrapInSQLException(thrownException);
 
 	}
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java Thu May 24 14:21:27 2007
@@ -133,7 +133,9 @@
 	{
         // Generate an EmbedSQLException
         SQLException e =
-            super.getSQLException(message, messageId, next, severity, t, args);
+            super.getSQLException(message, messageId,
+                (next == null ? null : getArgumentFerry(next)),
+                severity, t, args);
         return e;
 	}
 	

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TransactionResourceImpl.java Thu May 24 14:21:27 2007
@@ -342,7 +342,7 @@
 
 
 
-			return wrapInSQLException((SQLException) null, thrownException);
+			return wrapInSQLException(thrownException);
 
 		} catch (Throwable t) {
 
@@ -355,16 +355,16 @@
 			   We assume if we are in this degenerate
 			   case that it is actually a java exception
 			 */
-			throw wrapInSQLException((SQLException) null, t);
+			throw wrapInSQLException(t);
 			//throw t;
 		}
 
 	}
 		 
-	public static final SQLException wrapInSQLException(SQLException sqlException, Throwable thrownException) {
+	public static SQLException wrapInSQLException(Throwable thrownException) {
 
 		if (thrownException == null)
-			return sqlException;
+			return null;
 
 		SQLException nextSQLException;
 
@@ -377,30 +377,17 @@
 
 			StandardException se = (StandardException) thrownException;
 
-			nextSQLException = Util.generateCsSQLException(se);
-
-			wrapInSQLException(nextSQLException, se.getCause());
+            if (se.getCause() == null) {
+                nextSQLException = Util.generateCsSQLException(se);
+            } else {
+                nextSQLException = Util.seeNextException(se.getMessageId(),
+                        se.getArguments(), wrapInSQLException(se.getCause()));
+            }
 
 		} else {
 
 			nextSQLException = Util.javaException(thrownException);
 
-			// special case some java exceptions that have nested exceptions themselves
-			Throwable nestedByJVM = null;
-			if (thrownException instanceof ExceptionInInitializerError) {
-				nestedByJVM = ((ExceptionInInitializerError) thrownException).getException();
-			} else if (thrownException instanceof java.lang.reflect.InvocationTargetException) {
-				nestedByJVM = ((java.lang.reflect.InvocationTargetException) thrownException).getTargetException();
-			}
-
-			if (nestedByJVM != null) {
-				wrapInSQLException(nextSQLException, nestedByJVM);
-			}
-			
-		}
-
-		if (sqlException != null) {
-			sqlException.setNextException(nextSQLException);
 		}
 
 		return nextSQLException;

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/Util.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/Util.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/Util.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/Util.java Thu May 24 14:21:27 2007
@@ -231,8 +231,20 @@
 		msg = t.getMessage();
 		if (msg == null) msg = "";
 		name = t.getClass().getName();
+        SQLException next = null;
+        Throwable cause = t.getCause();
+        if (cause != null) {
+            if (cause instanceof SQLException) {
+                next = (SQLException) cause;
+            } else if (cause instanceof StandardException) {
+                next = generateCsSQLException((StandardException) cause);
+            } else {
+                next = javaException(cause);
+            }
+        }
 		return newEmbedSQLException(SQLState.JAVA_EXCEPTION,
-			new Object[] {name, msg}, ExceptionSeverity.NO_APPLICABLE_SEVERITY, t);
+                new Object[] {name, msg}, next,
+                ExceptionSeverity.NO_APPLICABLE_SEVERITY, t);
 	}
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/jdbc/EmbedXAResource.java Thu May 24 14:21:27 2007
@@ -771,8 +771,7 @@
      */
     private static XAException wrapInXAException(StandardException se) {
         return wrapInXAException(
-                TransactionResourceImpl.wrapInSQLException(
-                (SQLException) null, se));
+                TransactionResourceImpl.wrapInSQLException(se));
     }
     
     /**

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ProcedureInTriggerTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ProcedureInTriggerTest.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ProcedureInTriggerTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/ProcedureInTriggerTest.java Thu May 24 14:21:27 2007
@@ -235,12 +235,8 @@
         try {
             s.execute("insert into t2 values (1,2), (2,4)");
         } catch (SQLException se) {
-            //--- Bug DERBY-1629 -- in JDK 1.6 you only get 38001, not 38000
-            if (!JDBC.vmSupportsJDBC4())
-            {
-                assertSQLState("38000", se);
-                se = se.getNextException();
-            }
+            assertSQLState("38000", se);
+            se = se.getNextException();
             // Client does not get chained exceptions
             if (usingEmbedded())
                 assertSQLState("38001", se);           

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/SysDiagVTIMappingTest.java Thu May 24 14:21:27 2007
@@ -625,13 +625,7 @@
         cSt.setString(1, "SYSCS_DIAG");
         cSt.setString(2, vtiTableName.toUpperCase());
 
-        /* Currently BaseJDBCTestCase.assertSQLState() is unable
-         * to find nested SQLSTATEs with 1.6 JVMs, so we have to
-         * check for the top-level SQLSTATE in that case.  When
-         * that changes the "JDBC.vmSupportsJDBC4()" call can be
-         * removed from the following line.  DERBY-1440.
-         */
-        assertStatementError(JDBC.vmSupportsJDBC4() ? "38000" : "42X62", cSt);
+        assertStatementError("42X62", cSt);
         
         cSt = prepareCall(
             "call SYSCS_UTIL.SYSCS_INPLACE_COMPRESS_TABLE(?, ?, 1, 1, 1)");

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/XMLTypeAndOpsTest.java Thu May 24 14:21:27 2007
@@ -349,18 +349,12 @@
             "CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE ("
             + "  null, 'T1', 'xmlexport.del', null, null, null)");
 
-        /* Currently BaseJDBCTestCase.assertSQLState() is unable
-         * to find nested SQLSTATEs with 1.6 JVMs, so we have to
-         * check for the top-level SQLSTATE in that case.  When
-         * that changes the "JDBC.vmSupportsJDBC4()" call can be
-         * removed from the following line.
-         */
-        assertStatementError(JDBC.vmSupportsJDBC4() ? "38000" : "42Z71", cSt);
+        assertStatementError("42Z71", cSt);
         
         cSt = prepareCall(
             " CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY("
             + "  'select x from t1', 'xmlexport.del', null, null, null)");
-        assertStatementError(JDBC.vmSupportsJDBC4() ? "38000" : "42Z71", cSt);
+        assertStatementError("42Z71", cSt);
 
         cSt = prepareCall(
             " CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE ("

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportBinaryDataTest.java Thu May 24 14:21:27 2007
@@ -195,25 +195,17 @@
 
         doExportTable("APP", "BIN_TAB", fileName, null, null , null);
 
-        /* Currently BaseJDBCTestCase.assertSQLState() is unable
-         * to find nested SQLSTATEs with 1.6 JVMs, so we have to
-         * check for the top-level SQLSTATE in that case.  When
-         * that changes the "JDBC.vmSupportsJDBC4()" call can be
-         * removed from the following assertSQLState() calls.
-         * (DERBY-1440)
-         */
-
         try {
             doImportTable("APP", "BIN_TAB_IMP", fileName, "2", null, null, 0);
         } catch (SQLException e) {
-             assertSQLState(JDBC.vmSupportsJDBC4() ? "38000": "XIE0J", e);
+             assertSQLState("XIE0J", e);
         }
 
         try {
             doImportData(null, "BIN_TAB_IMP", null, 
                          null,  fileName, null, "c", null, 1);
         } catch (SQLException e) {
-            assertSQLState(JDBC.vmSupportsJDBC4() ? "38000": "XIE0J", e);
+            assertSQLState("XIE0J", e);
         }
     }
 
@@ -258,7 +250,7 @@
             doImportTable("APP", "BIN_TAB_IMP", fileName, null, null, null, 0);
             fail("import did not fail on data with invalid hex string");
         } catch (SQLException e) {
-             assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R": "XIE0N", e);
+             assertSQLState("XIE0N", e);
         }
 
         try {
@@ -268,7 +260,7 @@
                          fileName, null, null, null, 1);
             fail("import did not fail on data with invalid hex strings");
         } catch (SQLException e) {
-            assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R": "XIE0N", e);
+            assertSQLState("XIE0N", e);
         }
         
         try {
@@ -278,7 +270,7 @@
                          fileName, null, null, null, 1);
             fail("import did not fail on data with invalid hex strings");
         } catch (SQLException e) {
-            assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R": "XIE0N", e);
+            assertSQLState("XIE0N", e);
         }
     }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportLobTest.java Thu May 24 14:21:27 2007
@@ -226,7 +226,7 @@
             doImportTable("APP", "BOOKS_IMP", fileName, null, null, null, 0);
             fail("import did not fail on data with invalid hex string");
         } catch (SQLException e) {
-             assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R": "XIE0N", e);
+             assertSQLState("XIE0N", e);
         }
 
         try {
@@ -238,7 +238,7 @@
                          fileName, null, null, null, 1);
             fail("import did not fail on data with invalid hex strings");
         } catch (SQLException e) {
-            assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R": "XIE0N", e);
+            assertSQLState("XIE0N", e);
         }
 
         try {
@@ -250,7 +250,7 @@
                          fileName, null, null, null, 1);
             fail("import did not fail on data with invalid hex strings");
         } catch (SQLException e) {
-            assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R": "XIE0N", e);
+            assertSQLState("XIE0N", e);
         }
     }
 
@@ -375,27 +375,18 @@
         doExportQueryLobsToExtFile("select * from BOOKS where id < 10", 
                                    fileName, null, null, null, lobsFileName);
 
-
-        /* Currently BaseJDBCTestCase.assertSQLState() is unable
-         * to find nested SQLSTATEs with 1.6 JVMs, so we have to
-         * check for the top-level SQLSTATE in that case.  When
-         * that changes the "JDBC.vmSupportsJDBC4()" call can be
-         * removed from the following assertSQLState() calls.
-         * (DERBY-1440)
-         */
-
         try {
             doImportTableLobsFromExtFile("APP", "BOOKS_IMP", fileName, "2", 
                                          null, null, 0);
         } catch (SQLException e) {
-             assertSQLState(JDBC.vmSupportsJDBC4() ? "38000": "XIE0J", e);
+             assertSQLState("XIE0J", e);
         }
 
         try {
             doImportDataLobsFromExtFile(null, "BOOKS_IMP", null, 
                                       null,  fileName, null, "c", null, 1);
         } catch (SQLException e) {
-            assertSQLState(JDBC.vmSupportsJDBC4() ? "38000": "XIE0J", e);
+            assertSQLState("XIE0J", e);
         }
     }
 
@@ -432,7 +423,7 @@
             doImportTableLobsFromExtFile("APP", "BOOKS_IMP", fileName, 
                                          null, null, null, 0);
         }catch (SQLException e) {
-            assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R": "XIE0P", e);
+            assertSQLState("XIE0P", e);
         }
     }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java?view=diff&rev=541435&r1=541434&r2=541435
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportTest.java Thu May 24 14:21:27 2007
@@ -91,8 +91,7 @@
 			Connection c = getConnection();
 			doImport(c, "Z" , "T1" , null , null , null, 0);
 		} catch (SQLException e) {
-            // DERBY-1440: JDBC 4 client driver doesn't include nested exception SQLStates
-			assertSQLState(JDBC.vmSupportsJDBC4() ? "38000" : "XIE04", e);
+			assertSQLState("XIE04", e);
 		}
 	}
 	
@@ -101,8 +100,7 @@
 			Connection c = getConnection();
 			doImport(c, null, "T1" , null , null, null, 0);
 		} catch (SQLException e) {
-            // DERBY-1440: JDBC 4 client driver doesn't include nested exception SQLStates
-			assertSQLState(JDBC.vmSupportsJDBC4() ? "38000" : "XIE05", e);
+			assertSQLState("XIE05", e);
 		}
 	}
 	
@@ -166,8 +164,7 @@
 		try {
 			doImportFromFile(c, "extin/EndOfFile.txt" , "T4" , null , null , null, 0);
 		} catch (SQLException e) {
-			// DERBY-1440: JDBC 4 client driver doesn't include nested exception SQLStates
-			assertSQLState(JDBC.vmSupportsJDBC4() ? "XIE0R" : "XIE0E", e);
+			assertSQLState("XIE0E", e);
 		}
 	}