maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r731617 - /maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
Date Mon, 05 Jan 2009 16:49:01 GMT
Author: bentmann
Date: Mon Jan  5 08:49:01 2009
New Revision: 731617

URL: http://svn.apache.org/viewvc?rev=731617&view=rev
Log:
o Fixed file handle leak

Modified:
    maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java

Modified: maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java?rev=731617&r1=731616&r2=731617&view=diff
==============================================================================
--- maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
(original)
+++ maven/plugins/trunk/maven-install-plugin/src/test/java/org/apache/maven/plugin/install/InstallFileMojoTest.java
Mon Jan  5 08:49:01 2009
@@ -23,9 +23,11 @@
 import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
 
 import java.io.File;
-import java.io.FileReader;
+import java.io.Reader;
 
 /**
  * @author <a href="mailto:aramirez@apache.org">Allan Ramirez</a>
@@ -156,9 +158,18 @@
         File installedPom = new File( getBasedir(), LOCAL_REPO + groupId + "/" + artifactId
+ "/" + version + "/" +
             artifactId + "-" + version + "." + "pom" );
 
-        MavenXpp3Reader reader = new MavenXpp3Reader();
+        Model model;
 
-        Model model = reader.read( new FileReader( installedPom ) );
+        Reader reader = null;
+        try
+        {
+            reader = ReaderFactory.newXmlReader( installedPom );
+            model = new MavenXpp3Reader().read( reader );
+        }
+        finally
+        {
+            IOUtil.close( reader );
+        }
 
         assertEquals( "4.0.0", model.getModelVersion() );
 



Mime
View raw message