[ 
https://issues.apache.org/jira/browse/SANDBOX-287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Bodewig resolved SANDBOX-287.
------------------------------------

    Resolution: Fixed

deleted the class with svn revision 747071

> CompressUtils#compareByteArrays() looks wrong
> ---------------------------------------------
>
>                 Key: SANDBOX-287
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-287
>             Project: Commons Sandbox
>          Issue Type: Bug
>          Components: Compress
>            Reporter: Sebb
>
> CompressUtils#compareByteArrays() looks wrong.
> The Javadoc says that it compares two byte arrays, however the arrays are 
> treated differently:
> {code}
> 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;
>     }
> {code}
> 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?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to