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/08 11:22:27 UTC
DO NOT REPLY [Bug 47962] New: Fix string literal bugs and
inefficient object creation
https://issues.apache.org/bugzilla/show_bug.cgi?id=47962
Summary: Fix string literal bugs and inefficient object
creation
Product: POI
Version: 3.5-FINAL
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: POI Overall
AssignedTo: dev@poi.apache.org
ReportedBy: dhorwitz@gmail.com
Created an attachment (id=24361)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24361)
Fix string leteral first and inneficient obejct creation
The attached patch fixes 600+ occurrences of 2 common bug patterns identified
by Findbugs and other automated code checkers they are:
1) String literal first bugs (foo.equals("") rather than "".equals(foo))
2) Inefficient object creation (String, Boolean, Integer, Long) - e.g. new
Long(1) rather than Long.valueOf(1)
--
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 47962] Fix string literal bugs and inefficient
object creation
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47962
--- Comment #1 from David Horwitz <dh...@gmail.com> 2009-10-08 02:30:12 PDT ---
Created an attachment (id=24362)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=24362)
Improved patch - please disregard earlier
PLease use second patch the first contains 2 errors
--
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 47962] Fix string literal bugs and inefficient
object creation
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47962
David Horwitz <dh...@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dhorwitz@gmail.com
--
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 47962] Fix string literal bugs and inefficient
object creation
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=47962
Josh Micich <jo...@gildedtree.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #2 from Josh Micich <jo...@gildedtree.com> 2009-10-08 16:05:31 PDT ---
Thanks for the patch - some good clean up work.
Applied in svn r823348 with mods
Not all occurrences of 'foo.equals("bar")' were changed to '"bar".equals(foo)'.
Presumably this change is intended to reduce the likelihood of a
NullPointerException. In many cases however, it was clear that 'foo' could not
be null, and the code was left as-is for readability.
Regarding the box constructor vs valueOf() method changes - I'm pretty sure
there were no places where POI needs distinct instances, so most of these were
OK. However, a few changes were not applied for these reasons:
- caching of box instances generally applies to small integral values near
zero.
- Double.valueOf(double) does not utilize a DoubleCache or similar.
- Boolean.FALSE is better than Boolean.valueOf(false).
If you are keen to fix other compiler warnings that would be very much
appreciated. Please try to keep the patches smaller, to make them easier to
QA.
--
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