mirror of
https://github.com/apache/archiva.git
synced 2025-02-24 03:25:38 +00:00
correctly close jarFile in a finally block
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1358773 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a044b089c9
commit
35c58406a8
@ -752,6 +752,7 @@ public ArtifactContent getArtifactContentText( String groupId, String artifactId
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
closeQuietly( jarFile );
|
||||||
IOUtils.closeQuietly( inputStream );
|
IOUtils.closeQuietly( inputStream );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -782,6 +783,21 @@ public ArtifactContent getArtifactContentText( String groupId, String artifactId
|
|||||||
return new ArtifactContent();
|
return new ArtifactContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void closeQuietly( JarFile jarFile )
|
||||||
|
{
|
||||||
|
if ( jarFile != null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
jarFile.close();
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
log.warn( "ignore error closing jarFile {}", jarFile.getName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------
|
//---------------------------
|
||||||
// internals
|
// internals
|
||||||
//---------------------------
|
//---------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user