You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/07/17 18:44:19 UTC

svn commit: r965106 - /maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java

Author: bentmann
Date: Sat Jul 17 16:44:18 2010
New Revision: 965106

URL: http://svn.apache.org/viewvc?rev=965106&view=rev
Log:
[MASSEMBLY-490] Assembly fails with 'Too many files' error when converting line endings.

Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java?rev=965106&r1=965105&r2=965106&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java (original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/format/FileFormatter.java Sat Jul 17 16:44:18 2010
@@ -24,6 +24,7 @@ import org.apache.maven.plugin.assembly.
 import org.apache.maven.shared.filtering.MavenFilteringException;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.IOUtil;
 
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -97,9 +98,10 @@ public class FileFormatter
     private File formatLineEndings( String lineEndingChars, File source, File tempRoot )
         throws AssemblyFormattingException
     {
+        Reader contentReader = null;
         try
         {
-            Reader contentReader = new FileReader( source );
+            contentReader = new FileReader( source );
 
             File target = FileUtils.createTempFile( source.getName() + ".", ".formatted", tempRoot );
 
@@ -115,5 +117,9 @@ public class FileFormatter
         {
             throw new AssemblyFormattingException( "Error line formatting file '" + source + "': " + e.getMessage(), e );
         }
+        finally
+        {
+            IOUtil.close( contentReader );
+        }
     }
 }