db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r501392 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java
Date Tue, 30 Jan 2007 12:49:09 GMT
Author: kahatlen
Date: Tue Jan 30 04:49:08 2007
New Revision: 501392

URL: http://svn.apache.org/viewvc?view=rev&rev=501392
Log:
DERBY-2141 (partial) BlobClob4BlobTest.testPositionBlob() fails with NullPointerException

Preserve original stack trace for exceptions in JDBC 4.0 driver.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java

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=501392&r1=501391&r2=501392
==============================================================================
--- 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
Tue Jan 30 04:49:08 2007
@@ -131,7 +131,21 @@
 	private	SQLException	wrapArgsForTransportAcrossDRDA
 	( String message, String messageId, SQLException next, int severity, Throwable t, Object[]
args )
 	{
-		return super.getSQLException( message, messageId, next, severity, t, args );
+        // Generate an EmbedSQLException
+        SQLException e =
+            super.getSQLException(message, messageId, next, severity, t, args);
+
+        // We want to preserve the stack trace of the original
+        // exception. EmbedSQLException overrides printStackTrace() to achieve
+        // this, but that won't help us when the EmbedSQLException is not the
+        // first exception in the chain. Ideally, we would use initCause(), but
+        // a comment in EmbedSQLException indicates that the cause of the
+        // exception is not supposed to be serialized.
+        if (t != null) {
+            e.setStackTrace(t.getStackTrace());
+        }
+
+        return e;
 	}
 	
 }



Mime
View raw message