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 2010/07/08 21:46:36 UTC
svn commit: r961903 -
/db/derby/code/trunk/java/client/org/apache/derby/client/am/Blob.java
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)) {