Skip to content

Commit

Permalink
correctly close stream
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/tomcat/maven-plugin/trunk@1538554 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
olamy committed Nov 4, 2013
1 parent e3cfea6 commit deb3c48
Showing 1 changed file with 14 additions and 7 deletions.
Expand Up @@ -210,7 +210,7 @@ public abstract class AbstractExecWarMojo
*
* @since 2.2
*/
@Parameter( property = "maven.tomcat.exec.war.httpPort" )
@Parameter(property = "maven.tomcat.exec.war.httpPort")
protected String httpPort;

public void execute()
Expand Down Expand Up @@ -477,7 +477,7 @@ else if ( warRunDependencies != null && !warRunDependencies.isEmpty() )

protected void copyDirectoryContentIntoArchive( File pSourceFolder, String pDestinationPath,
ArchiveOutputStream pArchiveOutputSteam )
throws FileNotFoundException, IOException
throws IOException
{

// Scan the directory
Expand All @@ -492,12 +492,19 @@ protected void copyDirectoryContentIntoArchive( File pSourceFolder, String pDest
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 );
}
}

}
Expand Down

0 comments on commit deb3c48

Please sign in to comment.