db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r647682 - in /db/derby/code/branches/10.4/java/client/org/apache/derby/client/am: BlobLocatorInputStream.java ClobLocatorInputStream.java ClobLocatorReader.java
Date Mon, 14 Apr 2008 07:39:32 GMT
Author: kristwaa
Date: Mon Apr 14 00:39:29 2008
New Revision: 647682

URL: http://svn.apache.org/viewvc?rev=647682&view=rev
Log:
DERBY-2892:  Closing a resultset after retrieving a large > 32665 bytes value with Network
Server does not release locks.
Cleanup merged from trunk revision 647680 (derby-2892-2a-alternative_fix_cleanup.diff).

Modified:
    db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/BlobLocatorInputStream.java
    db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java
    db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorReader.java

Modified: db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/BlobLocatorInputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/BlobLocatorInputStream.java?rev=647682&r1=647681&r2=647682&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/BlobLocatorInputStream.java
(original)
+++ db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/BlobLocatorInputStream.java
Mon Apr 14 00:39:29 2008
@@ -21,12 +21,8 @@
 
 package org.apache.derby.client.am;
 
-import java.sql.SQLException;
-
 import java.io.IOException;
 
-import org.apache.derby.shared.common.error.ExceptionUtil;
-import org.apache.derby.shared.common.reference.SQLState;
 import org.apache.derby.shared.common.sanity.SanityManager;
 
 /**
@@ -189,38 +185,6 @@
     }
 
     /**
-     * Closes this input stream and releases any system resources associated
-     * with the stream.  This will release the underlying Blob value. 
-     *  
-     * @throws java.io.IOException
-     */
-    public void close() throws IOException {
-        try {
-            if (blob != null  && freeBlobOnClose) {
-                blob.free();
-            }
-        } catch (SQLException ex) {
-            if (ex.getSQLState().compareTo
-                    (ExceptionUtil.getSQLStateFromIdentifier
-                            (SQLState.LOB_OBJECT_INVALID)) == 0) {
-                // Blob has already been freed, probably because of autocommit
-                return;  // Ignore error
-            }
-
-            IOException ioEx = new IOException();
-            ioEx.initCause(ex);
-            throw ioEx;
-        }
-    }
-
-    /**
-     * Tell stream to free the underlying Blob when it is closed.
-     */
-    public void setFreeBlobOnClose() {
-        freeBlobOnClose = true;
-    }
-    
-    /**
      * Connection used to read Blob from server.
      */
     private final Connection connection;
@@ -241,11 +205,4 @@
      * maxPos starts counting from 1.
      */
     private final long maxPos;
- 
-    /**
-     * If true, the underlying Blob will be freed when the underlying stream is
-     * closed.  Used to implement correct behavior for streams obtained from
-     * result sets.
-     */
-    private boolean freeBlobOnClose = false;
 }

Modified: db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java?rev=647682&r1=647681&r2=647682&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java
(original)
+++ db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java
Mon Apr 14 00:39:29 2008
@@ -64,13 +64,6 @@
     private long currentPos;
     
     /**
-     * If true, the underlying Blob will be freed when the underlying stream is
-     * closed.  Used to implement correct behavior for streams obtained from
-     * result sets.
-     */
-    private boolean freeClobOnClose = false;
-
-    /**
      * Create an <code>InputStream</code> for reading the
      * <code>Clob</code> value represented by the given locator based
      * <code>Clob</code> object.
@@ -166,39 +159,6 @@
             throw ioEx;
         }
     }
-
-    /**
-     * Closes this input stream and releases any system resources associated
-     * with the stream.  This will release the underlying Clob value. 
-     *  
-     * @throws java.io.IOException
-     */
-    public void close() throws IOException {
-        try {
-            if (clob != null  && freeClobOnClose) {
-                clob.free();
-            }
-        } catch (SQLException ex) {
-            if (ex.getSQLState().compareTo
-                    (ExceptionUtil.getSQLStateFromIdentifier
-                            (SQLState.LOB_OBJECT_INVALID)) == 0) {
-                // Clob has already been freed, probably because of autocommit
-                return;  // Ignore error
-            }
-
-            IOException ioEx = new IOException();
-            ioEx.initCause(ex);
-            throw ioEx;
-        }
-    }
-      
-    /**
-     * Tell stream to free the underlying Clob when it is closed.
-     */
-    public void setFreeClobOnClose() {
-        freeClobOnClose = true;
-    }
-    
 
     /**
      * Returns a <code>Byte</code> array from the

Modified: db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorReader.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorReader.java?rev=647682&r1=647681&r2=647682&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorReader.java
(original)
+++ db/derby/code/branches/10.4/java/client/org/apache/derby/client/am/ClobLocatorReader.java
Mon Apr 14 00:39:29 2008
@@ -70,13 +70,6 @@
     private boolean isClosed = false;
     
     /**
-     * If true, the underlying Blob will be freed when the underlying stream is
-     * closed.  Used to implement correct behavior for streams obtained from
-     * result sets.
-     */
-    private boolean freeClobOnClose = false;
-
-    /**
      * Create an <code>Reader</code> for reading the
      * <code>Clob</code> value represented by the given locator based
      * <code>Clob</code> object.
@@ -175,30 +168,6 @@
             return;
         }
         isClosed = true;
-        
-        try {
-            if (clob != null && freeClobOnClose) {
-                clob.free();
-            }
-        } catch (SQLException ex) {
-            if (ex.getSQLState().compareTo
-                    (ExceptionUtil.getSQLStateFromIdentifier
-                            (SQLState.LOB_OBJECT_INVALID)) == 0) {
-                // Clob has already been freed, probably because of autocommit
-                return;  // Ignore error
-            }
-
-            IOException ioEx = new IOException();
-            ioEx.initCause(ex);
-            throw ioEx;
-        }
-    }
-
-    /**
-     * Tell stream to free the underlying Clob when it is closed.
-     */
-    public void setFreeClobOnClose() {
-        freeClobOnClose = true;
     }
 
     /**



Mime
View raw message