Author: fpj
Date: Thu Sep 18 15:47:50 2014
New Revision: 1626008

URL: http://svn.apache.org/r1626008
Log:
ZOOKEEPER-2039 Jute compareBytes incorrect comparison index (Ian Dimayuga via 
fpj)


Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/jute/Utils.java

Modified: zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1626008&r1=1626007&r2=1626008&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Thu Sep 18 15:47:50 2014
@@ -13,6 +13,8 @@ IMPROVEMENTS:
   ZOOKEEPER-2030 dynamicConfigFile should have an absolute path, not a relative
   path, to the dynamic configuration file (Alexander Shraer via michim)
 
+  ZOOKEEPER-2039 Jute compareBytes incorrect comparison index (Ian Dimayuga 
via fpj) 
+
 Release 3.5.0 - 8/4/2014
 
 NEW FEATURES:

Modified: zookeeper/trunk/src/java/main/org/apache/jute/Utils.java
URL: 
http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/jute/Utils.java?rev=1626008&r1=1626007&r2=1626008&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/jute/Utils.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/jute/Utils.java Thu Sep 18 
15:47:50 2014
@@ -268,15 +268,15 @@ public class Utils {
         return stream.toByteArray();
     }
     public static int compareBytes(byte b1[], int off1, int len1, byte b2[], 
int off2, int len2) {
-       int i;
-       for(i=0; i < len1 && i < len2; i++) {
-               if (b1[off1+i] != b2[off2+i]) {
-                       return b1[off1+i] < b2[off2+1] ? -1 : 1;
-               }
-       }
-       if (len1 != len2) {
-               return len1 < len2 ? -1 : 1;
-       }
-       return 0;
+        int i;
+        for(i=0; i < len1 && i < len2; i++) {
+            if (b1[off1+i] != b2[off2+i]) {
+                return b1[off1+i] < b2[off2+i] ? -1 : 1;
+            }
+        }
+        if (len1 != len2) {
+            return len1 < len2 ? -1 : 1;
+        }
+        return 0;
     }
 }


Reply via email to