]> source.dussan.org Git - archiva.git/commitdiff
[MRM-781] make sure file is closed
authorBrett Porter <brett@apache.org>
Wed, 23 Apr 2008 06:13:45 +0000 (06:13 +0000)
committerBrett Porter <brett@apache.org>
Wed, 23 Apr 2008 06:13:45 +0000 (06:13 +0000)
Submitted by: James William Dumay

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@650757 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/maven/archiva/webdav/ArchivaDavResource.java

index 6a3d5157642f58fd335ed85ac7fc3f9307d348c6..7c7361cd15f41377074167df38cd70059f9f9772 100644 (file)
@@ -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
         {