You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2006/01/31 06:26:15 UTC

svn commit: r373714 - in /ant/core/trunk: CONTRIBUTORS WHATSNEW contributors.xml src/main/org/apache/tools/ant/taskdefs/Available.java src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java

Author: bodewig
Date: Mon Jan 30 21:26:03 2006
New Revision: 373714

URL: http://svn.apache.org/viewcvs?rev=373714&view=rev
Log:
make sure classloader cleans up resources in any case, PR 38260, submitted by Stephan Michels

Modified:
    ant/core/trunk/CONTRIBUTORS
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Available.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java

Modified: ant/core/trunk/CONTRIBUTORS
URL: http://svn.apache.org/viewcvs/ant/core/trunk/CONTRIBUTORS?rev=373714&r1=373713&r2=373714&view=diff
==============================================================================
Binary files - no diff available.

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewcvs/ant/core/trunk/WHATSNEW?rev=373714&r1=373713&r2=373714&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon Jan 30 21:26:03 2006
@@ -181,6 +181,8 @@
 * <junit> task did not print all the Test names when using forkmode='once'.
   Bugzilla report 37426.
 
+* <available> could leak resources, Bugzilla Report 38260.
+
 Other changes:
 --------------
 * Minor performance improvements Bugzilla report 37777

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewcvs/ant/core/trunk/contributors.xml?rev=373714&r1=373713&r2=373714&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Mon Jan 30 21:26:03 2006
@@ -856,6 +856,10 @@
 	<name>
 		<last>stephan</last>
 	</name>
+  <name>
+    <first>Stephan</first>
+    <last>Michels</last>
+  </name>
 	<name>
 		<first>Stephen</first>
 		<last>Chin</last>

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Available.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Available.java?rev=373714&r1=373713&r2=373714&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Available.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Available.java Mon Jan 30 21:26:03 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2000-2005 The Apache Software Foundation
+ * Copyright  2000-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -233,6 +233,7 @@
      * @exception BuildException if the condition is not configured correctly
      */
     public boolean eval() throws BuildException {
+        try {
         if (classname == null && file == null && resource == null) {
             throw new BuildException("At least one of (classname|file|"
                                      + "resource) is required", getLocation());
@@ -273,12 +274,14 @@
                 Project.MSG_VERBOSE);
             return false;
         }
+        } finally {
         if (loader != null) {
             loader.cleanup();
             loader = null;
         }
         if (!isTask) {
             setTaskName(null);
+        }
         }
         return true;
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java?rev=373714&r1=373713&r2=373714&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java Mon Jan 30 21:26:03 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright  2000-2005 The Apache Software Foundation
+ * Copyright  2000-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -665,6 +665,7 @@
         JarFile wlJar = null;
         File newWLJarFile = null;
         JarOutputStream newJarStream = null;
+        ClassLoader genericLoader = null;
 
         try {
             log("Checking if weblogic Jar needs to be rebuilt for jar " + weblogicJarFile.getName(),
@@ -694,8 +695,7 @@
                 }
 
                 //Cycle Through generic and make sure its in weblogic
-                ClassLoader genericLoader
-                    = getClassLoaderFromJar(genericJarFile);
+                genericLoader = getClassLoaderFromJar(genericJarFile);
 
                 for (Enumeration e = genericEntries.keys(); e.hasMoreElements();) {
                     String filepath = (String) e.nextElement();
@@ -797,11 +797,6 @@
                     log("Weblogic Jar rebuild needed due to changed "
                          + "interface or XML", Project.MSG_VERBOSE);
                 }
-
-                if (genericLoader instanceof AntClassLoader) {
-                    AntClassLoader loader = (AntClassLoader) genericLoader;
-                    loader.cleanup();
-                }
             } else {
                 rebuild = true;
             }
@@ -845,6 +840,11 @@
                     log(renameException.getMessage(), Project.MSG_WARN);
                     rebuild = true;
                 }
+            }
+            if (genericLoader != null
+                && genericLoader instanceof AntClassLoader) {
+                AntClassLoader loader = (AntClassLoader) genericLoader;
+                loader.cleanup();
             }
         }
 



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