db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r543424 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl: jdbc/EmbedResultSet.java jdbc/EmbedStatement.java load/ImportReadData.java load/LoadError.java
Date Fri, 01 Jun 2007 08:24:35 GMT
Author: kahatlen
Date: Fri Jun  1 01:24:34 2007
New Revision: 543424

URL: http://svn.apache.org/viewvc?view=rev&rev=543424
Log:
DERBY-2472: Use Throwable.initCause() to improve error reporting

Fixed some callers of SQLException.setNextException() so that the
original exception would be visible without traversing the chain with
getNextException().

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/load/LoadError.java

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=543424&r1=543423&r2=543424
==============================================================================
--- 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 Fri Jun
 1 01:24:34 2007
@@ -4346,9 +4346,7 @@
 				try {
 					close();
 	    		} catch (Throwable t) {
-		        	SQLException top = handleException(t);
-					top.setNextException(sqle);
-					sqle = top;
+					sqle.setNextException(handleException(t));
 				}
 			}
 		}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java?view=diff&rev=543424&r1=543423&r2=543424
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java Fri Jun
 1 01:24:34 2007
@@ -972,6 +972,7 @@
 									sqle.getErrorCode(), successfulUpdateCount);
 
 			batch.setNextException(sqle);
+			batch.initCause(sqle);
 			throw batch;
       }
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java?view=diff&rev=543424&r1=543423&r2=543424
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/ImportReadData.java Fri Jun
 1 01:24:34 2007
@@ -242,13 +242,9 @@
         
       }
     } catch (FileNotFoundException ex) {
-      throw LoadError.dataFileNotFound(inputFileName);
+        throw LoadError.dataFileNotFound(inputFileName, ex);
     } catch (SecurityException se) {
-		java.sql.SQLException sqle = LoadError.dataFileNotFound(inputFileName);
-
-		sqle.setNextException(new java.sql.SQLException("XJ001", se.getMessage(), 0));
-
-		throw sqle;
+		throw LoadError.dataFileNotFound(inputFileName, se);
 	}
     java.io.Reader rd = dataCodeset == null ?
     		new InputStreamReader(inputStream) : new InputStreamReader(inputStream, dataCodeset);
   

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/load/LoadError.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/load/LoadError.java?view=diff&rev=543424&r1=543423&r2=543424
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/load/LoadError.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/load/LoadError.java Fri Jun  1 01:24:34
2007
@@ -58,11 +58,13 @@
 	/**
 	   Raised if, the passed data file can't be found.
 	   @param fileName the data file name 
+	   @param ex the exception that prevented us from opening the file
 	*/
-	static SQLException dataFileNotFound(String fileName) {
+	static SQLException dataFileNotFound(String fileName, Exception ex) {
 
 		return PublicAPI.wrapStandardException(
-			   StandardException.newException(SQLState.DATA_FILE_NOT_FOUND, fileName));
+			   StandardException.newException(SQLState.DATA_FILE_NOT_FOUND, ex,
+											  fileName));
 	}
 
   



Mime
View raw message