Bug 46822 - Avoid redundant instantiations in StandardContext
Summary: Avoid redundant instantiations in StandardContext
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2009-03-08 22:56 UTC by Anthony Whitford
Modified: 2009-04-28 04:00 UTC (History)
0 users

Patch file to replace new Booleans with primitive version (8.94 KB, patch)
2009-03-08 22:56 UTC, Anthony Whitford
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Whitford 2009-03-08 22:56:01 UTC
Created attachment 23358 [details]
Patch file to replace new Booleans with primitive version

While reviewing the source code, I noticed that java\org\apache\catalina\core\StandardContext.java code is creating Boolean objects unnecessarily.  For example:

                               new Boolean(oldAntiJARLocking),
                               new Boolean(this.antiJARLocking));

is instantiating Boolean objects when there is already a version of firePropertyChange that accepts boolean primitives.  So, the above can be rewritten to avoid instantiating new objects like:


This pattern was repeated for numerous properties.

I took the liberty of creating a patch.
Comment 1 Mark Thomas 2009-03-26 06:01:49 UTC
Thanks for the patch. This has been applied to trunk and proposed for 6.0.x.
Comment 2 Mark Thomas 2009-04-28 04:00:43 UTC
This has been fixed in 6.0.x and will be included in 6.0.20 onwards. Thanks again for the patch.