db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r616085 - in /db/derby/code/branches/10.3/java: engine/org/apache/derby/impl/load/ testing/org/apache/derbyTesting/functionTests/tests/tools/ testing/org/apache/derbyTesting/junit/
Date Mon, 28 Jan 2008 22:23:56 GMT
Author: kmarsden
Date: Mon Jan 28 14:23:55 2008
New Revision: 616085

URL: http://svn.apache.org/viewvc?rev=616085&view=rev
Log:
DERBY-3068 testImportExportProcedureNegative(org.apache.derbyTesting.functionTests.tests.tools.ImportExportProcedureTest)junit.framework.ComparisonFailure:
Unexpected SQL state. expected:<38000> but was:<XIE0S>

port revision 614893 from trunk.


Modified:
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Import.java
    db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/ImportAbstract.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
    db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Import.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Import.java?rev=616085&r1=616084&r2=616085&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Import.java (original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/Import.java Mon Jan
28 14:23:55 2008
@@ -84,7 +84,7 @@
 
 		}catch(Exception e)
 		{
-			throw LoadError.unexpectedError(e);
+			throw importError(e);
 		}
 	}
 

Modified: db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/ImportAbstract.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/ImportAbstract.java?rev=616085&r1=616084&r2=616085&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/ImportAbstract.java
(original)
+++ db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/load/ImportAbstract.java
Mon Jan 28 14:23:55 2008
@@ -21,6 +21,7 @@
 
 package org.apache.derby.impl.load;
 
+import java.io.IOException;
 import java.sql.SQLException;
 import java.sql.SQLWarning;
 import java.sql.ResultSetMetaData;
@@ -123,7 +124,7 @@
       lineNumber++;
       return (importReadData.readNextRow(nextRow));
     } catch (Exception ex) {
-		throw LoadError.unexpectedError(ex);
+		throw importError(ex);
 	}
   }
 
@@ -312,4 +313,24 @@
 			return false;
 
 	}
+        
+        /**
+         * Close the stream and wrap exception in a SQLException
+         * 
+         * @param ex  Exception causing the import error
+         * @throws SQLException
+         */
+        public  SQLException importError(Exception ex) {
+            Exception closeException = null;
+            if (importReadData != null)
+                try {
+                    importReadData.closeStream(); 
+                } catch (Exception e) {
+                    closeException = e;
+                }
+                SQLException le = LoadError.unexpectedError(ex);
+                if (closeException != null)
+                    le.setNextException(LoadError.unexpectedError(closeException));
+                return le;
+        }
 }

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java?rev=616085&r1=616084&r2=616085&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/ImportExportProcedureTest.java
Mon Jan 28 14:23:55 2008
@@ -1922,8 +1922,6 @@
             + "'extout/nodir/t1.dat' , null, null, null) ");
         assertStatementError("XIE0I", cSt);
 	
-	//DERBY-2925: need to delete existing files first.
-        SupportFilesSetup.deleteFile("extinout/t1.dat");
 
         //export table not found
         
@@ -1943,7 +1941,7 @@
         assertStatementError("38000", cSt);
        
 	//DERBY-2925: need to delete existing files first.
-        SupportFilesSetup.deleteFile("extout/t1.dat");
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
  
         //export query is invalid (syntax error)
         
@@ -2048,7 +2046,7 @@
             "call SYSCS_UTIL.SYSCS_EXPORT_TABLE ('IEP', 'T1' , "
             + "'extinout/t1.dat' , '\\a', '\\', null) ");
         assertStatementError("XIE0J", cSt);
-        
+                
         //DO A VALID EXPORT AND  IMPORT
         
         st.executeUpdate(
@@ -2070,6 +2068,8 @@
             + "'extinout/t1.dat' , null, null, 'utf-8', 0) ");
         assertUpdateCount(cSt, 0);
         
+        //  DERBY-2925: need to delete existing files 
+        SupportFilesSetup.deleteFile("extinout/t1.dat");
         rs = st.executeQuery(
             " select * from t1");
         

Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java?rev=616085&r1=616084&r2=616085&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
(original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/junit/SupportFilesSetup.java
Mon Jan 28 14:23:55 2008
@@ -30,6 +30,7 @@
 import java.security.PrivilegedActionException;
 
 import junit.extensions.TestSetup;
+import junit.framework.Assert;
 import junit.framework.Test;
 
 /**
@@ -268,17 +269,20 @@
     }
 
 
-    public static boolean deleteFile(final String fileName) 
+    public static void deleteFile(final String fileName) 
     {
-        Boolean ret = (Boolean) AccessController.doPrivileged
+        AccessController.doPrivileged
             (new java.security.PrivilegedAction() {
                         
                     public Object run() {
-                        return Boolean.valueOf((new File(fileName)).delete());
+                        File delFile = new File(fileName);
+                        if (!delFile.exists())
+                                return null;
+                         Assert.assertTrue(delFile.delete());
+                         return null;
                     }
                 }
              );
             
-        return ret.booleanValue();
     }
 }



Mime
View raw message