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:
Brett Leslie Porter 2005-03-22 10:07:01 +00:00
parent b63fd801d2
commit 336fa855be
1 changed files with 10 additions and 4 deletions

View File

@ -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,8 +200,7 @@ public class DefaultMavenProjectBuilder
{
try
{
project.setDistributionManagementArtifactRepository(
buildDistributionManagementRepository(
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 )