db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r547394 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java
Date Thu, 14 Jun 2007 20:23:32 GMT
Author: myrnavl
Date: Thu Jun 14 13:23:32 2007
New Revision: 547394

URL: http://svn.apache.org/viewvc?view=rev&rev=547394
Log:
DERBY-2715: Fix assertionFailedError in LobStreamsTest and 
  ClobUpdateableReaderTest.
  Patch contributed by Anurag Shekhar.

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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java?view=diff&rev=547394&r1=547393&r2=547394
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java Thu Jun
14 13:23:32 2007
@@ -397,6 +397,26 @@
         free();
     }
 
+    private void deleteFile (StorageFile file) throws IOException {
+        try {
+            final StorageFile sf = file;
+            AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                public Object run() throws IOException {
+                    sf.delete();
+                    return null;
+                }
+            });
+        } catch (PrivilegedActionException pae) {
+            Exception e = pae.getException();
+            if (e instanceof IOException)
+                throw (IOException) e;
+            if (e instanceof RuntimeException)
+                throw (RuntimeException) e;
+            IOException ioe = new IOException(e.getMessage());
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
     /**
      * Invalidates all the variables and closes file handle if open.
      * @throws IOexception
@@ -405,24 +425,8 @@
         dataBytes = null;
         if (tmpFile != null) {
             tmpFile.close();
-            try {
-                AccessController.doPrivileged (new PrivilegedExceptionAction() {
-                    public Object run() throws IOException {
-                        lobFile.delete();
-                        return null;
-                    }
-                });
-            }
-            catch (PrivilegedActionException pae) {
-                Exception e = pae.getException();
-                if (e instanceof IOException)
-                    throw (IOException) e;
-                if (e instanceof RuntimeException)
-                    throw (RuntimeException) e;
-                IOException ioe = new IOException (e.getMessage());
-                ioe.initCause (e);
-                throw ioe;
-            }
+            deleteFile(lobFile);
+            tmpFile = null;
         }
     }
     
@@ -470,6 +474,7 @@
             
             byte tmp [] = new byte [0];
             LOBFile oldFile = tmpFile;
+            StorageFile oldStoreFile = lobFile;
             init (tmp, 0);
             byte [] tmpByte = new byte [1024];
             long sz = stPos;
@@ -492,6 +497,8 @@
                         break;
                     tmpFile.write (tmpByte, 0, rdLen);
                 }while (true);
+                oldFile.close();
+                deleteFile(oldStoreFile);
             }            
         }
         updateCount++;



Mime
View raw message