Author: olamy
Date: Mon Nov 4 11:11:27 2013
New Revision: 1538554
URL: http://svn.apache.org/r1538554
Log:
correctly close stream
Modified:
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
Modified:
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
URL:
http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java?rev=1538554&r1=1538553&r2=1538554&view=diff
==============================================================================
---
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
(original)
+++
tomcat/maven-plugin/trunk/tomcat7-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat7/run/AbstractExecWarMojo.java
Mon Nov 4 11:11:27 2013
@@ -210,7 +210,7 @@ public abstract class AbstractExecWarMoj
*
* @since 2.2
*/
- @Parameter( property = "maven.tomcat.exec.war.httpPort" )
+ @Parameter(property = "maven.tomcat.exec.war.httpPort")
protected String httpPort;
public void execute()
@@ -477,7 +477,7 @@ public abstract class AbstractExecWarMoj
protected void copyDirectoryContentIntoArchive( File pSourceFolder, String
pDestinationPath,
ArchiveOutputStream
pArchiveOutputSteam )
- throws FileNotFoundException, IOException
+ throws IOException
{
// Scan the directory
@@ -492,12 +492,19 @@ public abstract class AbstractExecWarMoj
getLog().debug( "include configuration file : " + pDestinationPath
+ aIncludeFileName );
File aInputFile = new File( pSourceFolder, aIncludeFileName );
- FileInputStream aSourceFileInputStream = new FileInputStream(
aInputFile );
-
- pArchiveOutputSteam.putArchiveEntry( new JarArchiveEntry(
pDestinationPath + aIncludeFileName ) );
- IOUtils.copy( aSourceFileInputStream, pArchiveOutputSteam );
- pArchiveOutputSteam.closeArchiveEntry();
+ FileInputStream aSourceFileInputStream = null;
+ try
+ {
+ aSourceFileInputStream = new FileInputStream( aInputFile );
+ pArchiveOutputSteam.putArchiveEntry( new JarArchiveEntry(
pDestinationPath + aIncludeFileName ) );
+ IOUtils.copy( aSourceFileInputStream, pArchiveOutputSteam );
+ pArchiveOutputSteam.closeArchiveEntry();
+ }
+ finally
+ {
+ IOUtils.closeQuietly( aSourceFileInputStream );
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]