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/04/18 13:39:54 UTC

svn commit: r529987 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/Lob.java testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java

Author: kahatlen
Date: Wed Apr 18 04:39:53 2007
New Revision: 529987

URL: http://svn.apache.org/viewvc?view=rev&rev=529987
Log:
DERBY-2444: Clean up boundary checks for LOBs

Patch contributed by V. Narayanan.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java?view=diff&rev=529987&r1=529986&r2=529987
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Lob.java Wed Apr 18 04:39:53 2007
@@ -230,17 +230,12 @@
                 new ClientMessageId(SQLState.BLOB_BAD_POSITION),
                 new Long(pos)).getSQLException();
         }
-        if (pos > this.length()) {
-            throw new SqlException(agent_.logWriter_,
-                new ClientMessageId(SQLState.BLOB_POSITION_TOO_LARGE),
-                new Long(pos)).getSQLException();
-        }
         if (length < 0) {
             throw new SqlException(agent_.logWriter_,
                 new ClientMessageId(SQLState.BLOB_NONPOSITIVE_LENGTH),
                 new Integer((int)length)).getSQLException();
         }
-        if ((pos + length) > this.length()) {
+        if (length > (this.length() - pos)) {
             throw new SqlException(agent_.logWriter_,
                 new ClientMessageId(SQLState.POS_AND_LENGTH_GREATER_THAN_LOB),
                 new Long(pos), new Long(length)).getSQLException();

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java?view=diff&rev=529987&r1=529986&r2=529987
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobTest.java Wed Apr 18 04:39:53 2007
@@ -472,7 +472,7 @@
         catch(SQLException sqle) {
             // The SQLState for the exception thrown when pos > length of Blob
             // is XJ076
-            assertSQLState("XJ076", sqle);
+            assertSQLState("XJ087", sqle);
         }
 
         //check for the case when length < 0

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java?view=diff&rev=529987&r1=529986&r2=529987
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/ClobTest.java Wed Apr 18 04:39:53 2007
@@ -482,7 +482,7 @@
         catch(SQLException sqle) {
             // The SQLState for the exception thrown when pos > length of Clob
             // is XJ076
-            assertSQLState("XJ076", sqle);
+            assertSQLState("XJ087", sqle);
         }
 
         //check for the case when length < 0