This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new 2bae7499 VFS-849: Release httpConnection resources properly ... (#428)
2bae7499 is described below

commit 2bae74991dcdd967b53020617dd292990aeece72
Author: beise <[email protected]>
AuthorDate: Wed Sep 20 16:27:05 2023 +0200

    VFS-849: Release httpConnection resources properly ... (#428)
    
    * VFS-849: Release httpConnection resources properly ...
    
    by consuming the entire HttpEntity
    
    * VFS-849: Remove unnecessary consumption of HttpEntity ...
    
    because its already consumed.
    
    ---------
    
    Co-authored-by: Thorsten Beise <[email protected]>
---
 .../org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java     | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java
 
b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java
index f4023ca2..d2224a48 100644
--- 
a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java
+++ 
b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileObject.java
@@ -47,6 +47,7 @@ import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.client.utils.DateUtils;
 import org.apache.http.entity.ByteArrayEntity;
 import org.apache.http.entity.ContentType;
+import org.apache.http.util.EntityUtils;
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.MultiStatus;
@@ -487,6 +488,7 @@ public class Webdav4FileObject extends 
Http4FileObject<Webdav4FileSystem> {
             response = executeHttpUriRequest(request);
             final int status = response.getStatusLine().getStatusCode();
             if (status == HttpURLConnection.HTTP_NOT_FOUND || status == 
HttpURLConnection.HTTP_GONE) {
+                EntityUtils.consume(response.getEntity());
                 throw new FileNotFoundException(request.getURI());
             }
 

Reply via email to