Author: markh
Date: Fri Feb 29 07:00:28 2008
New Revision: 632336
URL: http://svn.apache.org/viewvc?rev=632336&view=rev
Log:
o Use plexus IOUtil to close streams
o Switch off caching for Jar input stream URL connection to avoid Jar file
locking
Modified:
maven/sandbox/trunk/shared/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java
Modified:
maven/sandbox/trunk/shared/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java?rev=632336&r1=632335&r2=632336&view=diff
==============================================================================
---
maven/sandbox/trunk/shared/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java
(original)
+++
maven/sandbox/trunk/shared/maven-runtime/src/main/java/org/apache/maven/shared/runtime/MavenRuntimeVisitorUtils.java
Fri Feb 29 07:00:28 2008
@@ -23,9 +23,12 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.net.URLConnection;
import java.util.jar.JarEntry;
import java.util.jar.JarInputStream;
+import org.codehaus.plexus.util.IOUtil;
+
/**
* Provides various methods of applying Maven runtime visitors.
*
@@ -145,7 +148,10 @@
try
{
- in = new JarInputStream( url.openStream() );
+ URLConnection connection = url.openConnection();
+ connection.setUseCaches( false );
+
+ in = new JarInputStream( connection.getInputStream() );
JarEntry entry;
@@ -160,17 +166,7 @@
}
finally
{
- try
- {
- if (in != null)
- {
- in.close();
- }
- }
- catch ( IOException exception )
- {
- throw new MavenRuntimeException( "Cannot close jar", exception
);
- }
+ IOUtil.close( in );
}
}