pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkühler (JIRA) <j...@apache.org>
Subject [jira] Resolved: (PDFBOX-409) Small hashcode issue, The code invokes hashCode on an array.
Date Sun, 01 Feb 2009 15:35:59 GMT

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

Andreas Lehmkühler resolved PDFBOX-409.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 0.8.0-incubator

Peters suggestion won't do it, because it is a java1.5-feature. But I guess getString().hashCode
will do it.

Thanks Peter

> 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: Peter_Lenahan@ibi.com
>            Priority: Minor
>             Fix For: 0.8.0-incubator
>
>
> 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.


Mime
View raw message