You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2009/10/09 09:46:31 UTC

DO NOT REPLY [Bug 47969] New: Problematic equals methods

https://issues.apache.org/bugzilla/show_bug.cgi?id=47969

           Summary: Problematic equals methods
           Product: POI
           Version: 3.5-FINAL
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: dhorwitz@gmail.com


Created an attachment (id=24367)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24367)
Fix 4 problematic equals statements

There are 4 equals methods in the org.apache.ss package
that show the same broken pattern. They assume that they are being passed
non-null values of the same Class. The attached patch fixes these.

The classes affected are:
java/org/apache/poi/ss/formula/eval/forked/ForkedEvaluationSheet.java
org/apache/poi/ss/formula/FormulaUsedBlankCellSet.java
java/org/apache/poi/ss/formula/PlainCellCache.java
java/org/apache/poi/ss/util/MutableFPNumber.java

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 47969] Problematic equals methods

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47969

Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Josh Micich <jo...@gildedtree.com> 2009-10-13 16:39:04 UTC ---
I guess these 'problems' were also found by an automated code checker. 
Actually, all four equals() methods were optimised for performance, knowing
that the instanceof check is not needed.  Note that none of the classes is
public.  I am pretty sure it is impossible to get a CCE or NPE from any of
these methods, no matter how you exercise POI.

Nonetheless, there's value in making it clear that code is not broken, so I
have added "assert obj instanceof <MyKeyClass>" statements to three of the
equals method, and deleted one which was unused (svn r824972 ). This change
should have negligible performance impact and should also suppress the code
checker warning.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org