directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1449694 - /directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java
Date Mon, 25 Feb 2013 13:13:04 GMT
Author: pamarcelot
Date: Mon Feb 25 13:13:03 2013
New Revision: 1449694

URL: http://svn.apache.org/r1449694
Log:
Fixed a bug when the string we were looking for in the byte[] or char[] was longer than the
remaining bytes or chars (from the given index). An ArrayOutOfBoundsException was thrown then.

Modified:
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java?rev=1449694&r1=1449693&r2=1449694&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java Mon
Feb 25 13:13:03 2013
@@ -909,7 +909,7 @@ public final class Strings
     {
         if ( ( chars == null ) || ( chars.length == 0 ) || ( chars.length <= index ) ||
( index < 0 )
             || ( chars2 == null ) || ( chars2.length == 0 )
-            || ( chars2.length > ( chars.length + index ) ) )
+            || ( chars2.length > ( chars.length - index ) ) )
         {
             return StringConstants.NOT_EQUAL;
         }
@@ -940,7 +940,7 @@ public final class Strings
     {
         if ( ( bytes == null ) || ( bytes.length == 0 ) || ( bytes.length <= index ) ||
( index < 0 )
             || ( bytes2 == null ) || ( bytes2.length == 0 )
-            || ( bytes2.length > ( bytes.length + index ) ) )
+            || ( bytes2.length > ( bytes.length - index ) ) )
         {
             return StringConstants.NOT_EQUAL;
         }



Mime
View raw message