You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by el...@apache.org on 2020/07/10 12:27:40 UTC
[maven-war-plugin] branch close created (now f50ca74)
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a change to branch close
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git.
at f50ca74 close ClassLoader
This branch includes the following new commits:
new f50ca74 close ClassLoader
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[maven-war-plugin] 01/01: close ClassLoader
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elharo pushed a commit to branch close
in repository https://gitbox.apache.org/repos/asf/maven-war-plugin.git
commit f50ca742fd6a9029a26813b95aef95e86aed51a3
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Fri Jul 10 08:25:42 2020 -0400
close ClassLoader
---
src/main/java/org/apache/maven/plugins/war/WarMojo.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/war/WarMojo.java b/src/main/java/org/apache/maven/plugins/war/WarMojo.java
index e30c571..523a145 100644
--- a/src/main/java/org/apache/maven/plugins/war/WarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/war/WarMojo.java
@@ -313,9 +313,20 @@ public class WarMojo
{
urls[i] = new File( classpathElements.get( i ) ).toURI().toURL();
}
- ClassLoader loader = new URLClassLoader( urls, Thread.currentThread().getContextClassLoader() );
-
- return hasWebServletAnnotationClassInClasspath( loader );
+ URLClassLoader loader = new URLClassLoader( urls, Thread.currentThread().getContextClassLoader() );
+ try {
+ return hasWebServletAnnotationClassInClasspath( loader );
+ }
+ finally {
+ try
+ {
+ loader.close();
+ }
+ catch ( IOException ex )
+ {
+ // ignore
+ }
+ }
}
private static boolean hasWebServletAnnotationClassInClasspath( ClassLoader loader )