Small hashcode issue, The code invokes hashCode on an array.
------------------------------------------------------------
Key: PDFBOX-409
URL: https://issues.apache.org/jira/browse/PDFBOX-409
Project: PDFBox
Issue Type: Bug
Affects Versions: 0.8.0-incubator
Environment: All
Reporter: [email protected]
Priority: Minor
This problem is reported by the Findbugs tool.
package org.apache.pdfbox.cos;
public class COSString extends COSBase
public int hashCode()
{
return getBytes().hashCode();
}
Invocation of hashCode on an array
The code invokes hashCode on an array. Calling hashCode on an array returns the
same value as System.identityHashCode, and ignores the contents and length of
the array. If you need a hashCode that depends on the contents of an array a,
use java.util.Arrays.hashCode(a).
This might be a better solution.
public int hashCode()
{
return java.util.Arrays.hashCode (getBytes());
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.