tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (TIKA-415) Findbugs: XHTMLDowngradeHandler equals() comparing different types
Date Wed, 12 May 2010 14:38:41 GMT

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

Jukka Zitting resolved TIKA-415.
--------------------------------

         Assignee: Jukka Zitting
    Fix Version/s: 0.8
       Resolution: Fixed

Good point, thanks! Fixed in revision 943518.

> Findbugs: XHTMLDowngradeHandler  equals() comparing different types
> -------------------------------------------------------------------
>
>                 Key: TIKA-415
>                 URL: https://issues.apache.org/jira/browse/TIKA-415
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.7
>            Reporter: Peter_Lenahan@ibi.com
>            Assignee: Jukka Zitting
>            Priority: Minor
>             Fix For: 0.8
>
>
> Findbugs reports that there is an incompatible type comparison between a string and an
integer.
> NULL_NS_URI  is a blank, where the value it is comparing it to is an integer. 
> They will never match, making the statement useless.
> The value always returns false, then it is "notted" making it always true.
> public static final String NULL_NS_URI = "";  
>    if (!XMLConstants.NULL_NS_URI.equals(atts.getURI(i).length())
>             if (!XMLConstants.NULL_NS_URI.equals(atts.getURI(i).length())
>                     && !local.equals(XMLConstants.XMLNS_ATTRIBUTE)
>                     && !qname.startsWith(XMLConstants.XMLNS_ATTRIBUTE + ":"))
{
> Bug: Call to equals() comparing different types
> Pattern id: EC_UNRELATED_TYPES, type: EC, category: CORRECTNESS
> This method calls equals(Object) on two references of different class types with no common
subclasses. Therefore, the objects being compared are unlikely to be members of the same class
at runtime (unless some application classes were not analyzed, or dynamic class loading can
occur at runtime). According to the contract of equals(), objects of different classes should
always compare as unequal; therefore, according to the contract defined by java.lang.Object.equals(Object),
the result of this comparison will always be false at runtime. 

-- 
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