ASF Bugzilla – Attachment 12131 Details for
Bug 30162
[PATCH] Avoid potential memory leaks from IntrospectionHelper.helpers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested patch
ant30162.diff (text/plain), 4.00 KB, created by
Jesse Glick
on 2004-07-16 23:55:11 UTC
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Jesse Glick
Created:
2004-07-16 23:55:11 UTC
Size:
4.00 KB
patch
obsolete
>Index: src/main/org/apache/tools/ant/taskdefs/AntStructure.java >=================================================================== >RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/AntStructure.java,v >retrieving revision 1.41 >diff -u -r1.41 AntStructure.java >--- src/main/org/apache/tools/ant/taskdefs/AntStructure.java 9 Mar 2004 16:48:03 -0000 1.41 >+++ src/main/org/apache/tools/ant/taskdefs/AntStructure.java 16 Jul 2004 23:48:30 -0000 >@@ -201,7 +201,7 @@ > > IntrospectionHelper ih = null; > try { >- ih = IntrospectionHelper.getHelper(element); >+ ih = IntrospectionHelper.getHelper(getProject(), element); > } catch (Throwable t) { > /* > * XXX - failed to load the class properly. >Index: src/main/org/apache/tools/ant/UnknownElement.java >=================================================================== >RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/UnknownElement.java,v >retrieving revision 1.81 >diff -u -r1.81 UnknownElement.java >--- src/main/org/apache/tools/ant/UnknownElement.java 10 Jun 2004 18:01:47 -0000 1.81 >+++ src/main/org/apache/tools/ant/UnknownElement.java 16 Jul 2004 23:48:30 -0000 >@@ -320,7 +320,7 @@ > > String parentUri = getNamespace(); > Class parentClass = parent.getClass(); >- IntrospectionHelper ih = IntrospectionHelper.getHelper(parentClass); >+ IntrospectionHelper ih = IntrospectionHelper.getHelper(getProject(), parentClass); > > > if (children != null) { >Index: src/main/org/apache/tools/ant/ProjectHelper.java >=================================================================== >RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/ProjectHelper.java,v >retrieving revision 1.113 >diff -u -r1.113 ProjectHelper.java >--- src/main/org/apache/tools/ant/ProjectHelper.java 24 May 2004 15:09:55 -0000 1.113 >+++ src/main/org/apache/tools/ant/ProjectHelper.java 16 Jul 2004 23:48:30 -0000 >@@ -305,9 +305,7 @@ > } > > IntrospectionHelper ih = >- IntrospectionHelper.getHelper(target.getClass()); >- >- project.addBuildListener(ih); >+ IntrospectionHelper.getHelper(project, target.getClass()); > > for (int i = 0; i < attrs.getLength(); i++) { > // reflect these into the target >@@ -369,7 +367,7 @@ > target = ((TypeAdapter) target).getProxy(); > } > >- IntrospectionHelper.getHelper(target.getClass()).addText(project, >+ IntrospectionHelper.getHelper(project, target.getClass()).addText(project, > target, text); > } > >@@ -389,7 +387,7 @@ > public static void storeChild(Project project, Object parent, > Object child, String tag) { > IntrospectionHelper ih >- = IntrospectionHelper.getHelper(parent.getClass()); >+ = IntrospectionHelper.getHelper(project, parent.getClass()); > ih.storeElement(project, parent, child, tag); > } > >Index: src/main/org/apache/tools/ant/IntrospectionHelper.java >=================================================================== >RCS file: /home/cvspublic/ant/src/main/org/apache/tools/ant/IntrospectionHelper.java,v >retrieving revision 1.85 >diff -u -r1.85 IntrospectionHelper.java >--- src/main/org/apache/tools/ant/IntrospectionHelper.java 12 Jun 2004 16:51:09 -0000 1.85 >+++ src/main/org/apache/tools/ant/IntrospectionHelper.java 16 Jul 2004 23:48:30 -0000 >@@ -26,6 +26,8 @@ > import java.util.Hashtable; > import java.util.List; > import java.util.Locale; >+import java.util.Map; >+import java.util.WeakHashMap; > import org.apache.tools.ant.types.EnumeratedAttribute; > import org.apache.tools.ant.taskdefs.PreSetDef; > >@@ -78,9 +80,9 @@ > private Class bean; > > /** >- * Helper instances we've already created (Class to IntrospectionHelper). >+ * Helper instances we've already created for particular classes. > */ >- private static Hashtable helpers = new Hashtable(); >+ private static Map/*<Class,IntrospectionHelper>*/ helpers = new WeakHashMap(); > > /** > * Map from primitive types to wrapper classes for use in
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 30162
: 12131 |
12198