You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Sergey Vladimirov (JIRA)" <ji...@apache.org> on 2011/05/14 15:01:47 UTC
[jira] [Commented] (PDFBOX-711) Findbugs: Bug: Doomed test for
equality to NaN PDFTextStripper.java
[ https://issues.apache.org/jira/browse/PDFBOX-711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033523#comment-13033523 ]
Sergey Vladimirov commented on PDFBOX-711:
------------------------------------------
Still present in 1.6.0 trunk. / Revision 1.70 / line 664
http://svn.apache.org/repos/asf/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java
Reopen?
> Findbugs: Bug: Doomed test for equality to NaN PDFTextStripper.java
> -------------------------------------------------------------------
>
> Key: PDFBOX-711
> URL: https://issues.apache.org/jira/browse/PDFBOX-711
> Project: PDFBox
> Issue Type: Bug
> Components: Utilities
> Affects Versions: 1.1.0
> Reporter: Peter_Lenahan@ibi.com
> Fix For: 1.2.0
>
>
> org.apache.pdfbox.util.PDFTextStripper.java
> if ((wordSpacing == 0) || (wordSpacing == Float.NaN))
> (wordSpacing == Float.NaN) always fails, should use the method to test the value.
> if ((wordSpacing == 0) || Float.isNaN(wordSpacing )
> Findbugs Description: Bug: Doomed test for equality to NaN
> Pattern id: FE_TEST_IF_EQUAL_TO_NOT_A_NUMBER, type: FE, category: CORRECTNESS
> This code checks to see if a floating point value is equal to the special Not A Number value (e.g., if (x == Double.NaN)). However, because of the special semantics of NaN, no value is equal to Nan, including NaN. Thus, x == Double.NaN always evaluates to false. To check to see if a value contained in x is the special Not A Number value, use Double.isNaN(x) (or Float.isNaN(x) if x is floating point precision).
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira