db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r961903 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java
Date Thu, 08 Jul 2010 19:46:36 GMT
Author: kahatlen
Date: Thu Jul  8 19:46:36 2010
New Revision: 961903

URL: http://svn.apache.org/viewvc?rev=961903&view=rev
Log:
DERBY-4738: correct error prompt for nonpositive length in Blob.setBytesX()

Move declaration and initialization of the length variable later so that
bugs of this kind could be detected at compile time.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java?rev=961903&r1=961902&r2=961903&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java Thu Jul  8 19:46:36
2010
@@ -428,8 +428,6 @@ public class Blob extends Lob implements
     }
 
     public int setBytesX(long pos, byte[] bytes, int offset, int len) throws SqlException
{
-        int length = 0;
-        
         /*
             Check if position is less than 0 and if true
             raise an exception
@@ -472,7 +470,8 @@ public class Blob extends Lob implements
             return 0;
         }
         
-        length = Math.min((bytes.length - offset), len);
+        final int length = Math.min((bytes.length - offset), len);
+
         if (isLocator()) {  
             byte[] ba = bytes;
             if ((offset > 0) || (length < bytes.length)) { 



Mime
View raw message