Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
CompressUtils#compareByteArrays() looks wrong.
The Javadoc says that it compares two byte arrays, however the arrays are treated differently:
public static boolean compareByteArrays(byte[] source, byte[] match) { int i = 0; while(source.length < i || i < match.length ) { if(source[i] != match[i]) { return false; } i++; } return true; }
The code will keep checking bytes from match[] until there is a mismatch with source[].
If source[] is shorther than match[] then ArrayOutOfBoundsException will be generated.
If source[] is longer than match[], then trailing bytes in source[] will be ignored.
Neither behaviour seems particularly useful...
The method does not appear to be used, so perhaps it should just be deleted?