You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2009/02/11 20:17:02 UTC
[jira] Created: (SANDBOX-287) CompressUtils#compareByteArrays()
looks wrong
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.
[jira] Commented: (SANDBOX-287) CompressUtils#compareByteArrays()
looks wrong
Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SANDBOX-287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12672948#action_12672948 ]
Stefan Bodewig commented on SANDBOX-287:
----------------------------------------
the whole CompressUtils class seems to be unused. I dont see any reason to keep it at all.
> 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.
[jira] Updated: (COMPRESS-21) CompressUtils#compareByteArrays()
looks wrong
Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stefan Bodewig updated COMPRESS-21:
-----------------------------------
Fix Version/s: 1.0
> CompressUtils#compareByteArrays() looks wrong
> ---------------------------------------------
>
> Key: COMPRESS-21
> URL: https://issues.apache.org/jira/browse/COMPRESS-21
> Project: Commons Compress
> Issue Type: Bug
> Reporter: Sebb
> Fix For: 1.0
>
>
> 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.
[jira] Moved: (COMPRESS-21) CompressUtils#compareByteArrays() looks
wrong
Posted by "Dennis Lundberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COMPRESS-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dennis Lundberg moved SANDBOX-287 to COMPRESS-21:
-------------------------------------------------
Component/s: (was: Compress)
Key: COMPRESS-21 (was: SANDBOX-287)
Project: Commons Compress (was: Commons Sandbox)
> CompressUtils#compareByteArrays() looks wrong
> ---------------------------------------------
>
> Key: COMPRESS-21
> URL: https://issues.apache.org/jira/browse/COMPRESS-21
> Project: Commons Compress
> Issue Type: Bug
> 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.
[jira] Resolved: (SANDBOX-287) CompressUtils#compareByteArrays()
looks wrong
Posted by "Stefan Bodewig (JIRA)" <ji...@apache.org>.
[ 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.