mirror of https://github.com/apache/maven.git
close file handle
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163651 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b63fd801d2
commit
336fa855be
|
@ -47,6 +47,7 @@ import org.codehaus.plexus.context.Context;
|
|||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -199,9 +200,8 @@ public class DefaultMavenProjectBuilder
|
|||
{
|
||||
try
|
||||
{
|
||||
project.setDistributionManagementArtifactRepository(
|
||||
buildDistributionManagementRepository(
|
||||
dm.getRepository() ) );
|
||||
project.setDistributionManagementArtifactRepository( buildDistributionManagementRepository(
|
||||
dm.getRepository() ) );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
|
@ -413,9 +413,11 @@ public class DefaultMavenProjectBuilder
|
|||
private Model readModel( File file )
|
||||
throws ProjectBuildingException
|
||||
{
|
||||
FileReader reader = null;
|
||||
try
|
||||
{
|
||||
return modelReader.read( new FileReader( file ) );
|
||||
reader = new FileReader( file );
|
||||
return modelReader.read( reader );
|
||||
}
|
||||
catch ( FileNotFoundException e )
|
||||
{
|
||||
|
@ -426,6 +428,10 @@ public class DefaultMavenProjectBuilder
|
|||
throw new ProjectBuildingException(
|
||||
"Error while reading model from file '" + file.getAbsolutePath() + "'.", e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( reader );
|
||||
}
|
||||
}
|
||||
|
||||
private Model readModel( URL url )
|
||||
|
|
Loading…
Reference in New Issue