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/03/27 13:05:44 UTC

svn commit: r522866 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/functionTests/master/

Author: kahatlen
Date: Tue Mar 27 04:05:41 2007
New Revision: 522866

URL: http://svn.apache.org/viewvc?view=rev&rev=522866
Log:
DERBY-2472: Use Throwable.setStackTrace() in EmbedSQLException

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSQLException.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/SQLExceptionFactory40.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/closed.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/releaseCompileLocks.out

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSQLException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSQLException.java?view=diff&rev=522866&r1=522865&r2=522866
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSQLException.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedSQLException.java Tue Mar 27 04:05:41 2007
@@ -74,7 +74,10 @@
 		arguments = args;
 		if (nextException !=null)
 			this.setNextException(nextException);
-		javaException = t;
+		if (t != null) {
+			javaException = t;
+			setStackTrace(t.getStackTrace());
+		}
 	}
     
 	public Throwable getJavaException() {
@@ -87,46 +90,6 @@
 
 	public Object[] getArguments() {
 		return arguments;
-	}
-
-	/**
-		Print the stack trace of the wrapped java exception or this
-		exception if there is none.
-
-		@see Throwable#printStackTrace
-	*/
-	public void printStackTrace() {
-		Throwable je = getJavaException();
-		if (je != null)
-			je.printStackTrace();
-		else
-			super.printStackTrace();
-	}
-	/**
-		Print the stack trace of the wrapped java exception or this
-		exception if there is none.
-
-		@see Throwable#printStackTrace
-	*/
-	public void printStackTrace(PrintStream s) {
-		Throwable je = getJavaException();
-		if (je != null)
-			je.printStackTrace(s);
-		else
-			super.printStackTrace(s);
-	}
-	/**
-		Print the stack trace of the wrapped java exception or this
-		exception if there is none.
-
-		@see Throwable#printStackTrace
-	*/
-	public void printStackTrace(PrintWriter s) {
-		Throwable je = getJavaException();
-		if (je != null)
-			je.printStackTrace(s);
-		else
-			super.printStackTrace(s);
 	}
 
 	/*

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=522866&r1=522865&r2=522866
==============================================================================
--- 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 Mar 27 04:05:41 2007
@@ -134,17 +134,6 @@
         // 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;
 	}
 	

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/closed.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/closed.out?view=diff&rev=522866&r1=522865&r2=522866
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/closed.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/closed.out Tue Mar 27 04:05:41 2007
@@ -12,13 +12,13 @@
 ERROR 08003: No current connection.
 ERROR 08003: No current connection.
 Test database shutdown ...
-ERROR 08006: Database 'wombat' shutdown.
+java.sql.SQLException: Database 'wombat' shutdown.
 CALL sleep(10000) - 38000, 38000 -- InterruptedException, XJ001 -- InterruptedException
 LOCK TABLE CLOSED.LOCKME IN EXCLUSIVE MODE - 08006, 08006 -- Database 'wombat' shutdown.
 ERROR 08006: Database 'wombat' shutdown.
 Shutdown test completed.
 Test system shutdown ...
-ERROR 08006: Database 'wombat' shutdown.
+java.sql.SQLException: Database 'wombat' shutdown.
 CALL sleep(10000) - 38000, 38000 -- InterruptedException, XJ001 -- InterruptedException
 LOCK TABLE CLOSED.LOCKME IN EXCLUSIVE MODE - 08006, 08006 -- Database 'wombat' shutdown.
 ERROR XJ015: Derby system shutdown.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/releaseCompileLocks.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/releaseCompileLocks.out?view=diff&rev=522866&r1=522865&r2=522866
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/releaseCompileLocks.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/releaseCompileLocks.out Tue Mar 27 04:05:41 2007
@@ -45,7 +45,7 @@
 1          
 -----------
 Caught exception java.sql.SQLException: The external routine is not allowed to execute SQL statements.
-ERROR 38001: The external routine is not allowed to execute SQL statements.
+java.sql.SQLException: The external routine is not allowed to execute SQL statements.
 1          
 ij> select TYPE, MODE, TABLENAME, LOCKNAME, STATE from syscs_diag.lock_table
 order by 1;
@@ -63,7 +63,7 @@
 1          
 -----------
 Caught exception java.sql.SQLException: The external routine is not allowed to execute SQL statements.
-ERROR 38001: The external routine is not allowed to execute SQL statements.
+java.sql.SQLException: The external routine is not allowed to execute SQL statements.
 1          
 ij> -- only two locks!
 select TYPE, MODE, TABLENAME, LOCKNAME, STATE from syscs_diag.lock_table