diff options
author | Olivier Lamy <olamy@apache.org> | 2013-12-19 00:51:34 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-12-19 00:51:34 +0000 |
commit | fae670bbc1cdee91cdc074f88a3204e43671f296 (patch) | |
tree | e012f93e227e45a9fe3ca697c028098a8881733d | |
parent | 14736745e4725a2b5f009ae6ef3db6836dc4fa48 (diff) | |
download | archiva-fae670bbc1cdee91cdc074f88a3204e43671f296.tar.gz archiva-fae670bbc1cdee91cdc074f88a3204e43671f296.zip |
correctly close streams
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1552191 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java index eefe81a7b..59c352b25 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java @@ -575,17 +575,19 @@ public class DefaultFileUploadService private void copyFile( File sourceFile, File targetPath, String targetFilename, boolean fixChecksums ) throws IOException { - FileOutputStream out = new FileOutputStream( new File( targetPath, targetFilename ) ); - FileInputStream input = new FileInputStream( sourceFile ); + FileOutputStream out = null; + FileInputStream input = null; try { + out = new FileOutputStream( new File( targetPath, targetFilename ) ); + input = new FileInputStream( sourceFile ); IOUtils.copy( input, out ); } finally { - out.close(); - input.close(); + IOUtils.closeQuietly( out ); + IOUtils.closeQuietly( input ); } if ( fixChecksums ) |