diff options
author | Brett Porter <brett@apache.org> | 2008-04-23 06:13:45 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2008-04-23 06:13:45 +0000 |
commit | 821383090013b3d9f9b40eae158943b25bcac0e5 (patch) | |
tree | 04ae4039e016e23612af2861d5fe56b6dea49133 /archiva-modules | |
parent | 9d1f342bc5daa06270283d4635c32af4e6307011 (diff) | |
download | archiva-821383090013b3d9f9b40eae158943b25bcac0e5.tar.gz archiva-821383090013b3d9f9b40eae158943b25bcac0e5.zip |
[MRM-781] make sure file is closed
Submitted by: James William Dumay
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@650757 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
-rw-r--r-- | archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java index 6a3d51576..7c7361cd1 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java @@ -132,9 +132,20 @@ public class ArchivaDavResource implements DavResource { if (!isCollection()) { - IOUtils.copy(new FileInputStream(localResource), outputContext.getOutputStream()); - outputContext.setContentLength(getContentLength()); - outputContext.setContentType(getContentType()); + FileInputStream is = null; + try + { + outputContext.setContentLength(getContentLength()); + outputContext.setContentType(getContentType()); + + //Write content to stream + is = new FileInputStream(localResource); + IOUtils.copy(is, outputContext.getOutputStream()); + } + finally + { + IOUtils.closeQuietly(is); + } } else { |