You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2019/11/24 21:37:40 UTC

[maven-wagon] branch WAGON-573 updated (645787a -> cd3bb5c)

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

michaelo pushed a change to branch WAGON-573
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git.


 discard 645787a  [WAGON-573] EntityUtils.consumeQuietly() never called on non-2xx status codes
     add 463e916  [maven-release-plugin] prepare release wagon-3.3.4
     add a332328  [maven-release-plugin] prepare for next development iteration
     new cd3bb5c  [WAGON-573] EntityUtils.consumeQuietly() never called on non-2xx status codes

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (645787a)
            \
             N -- N -- N   refs/heads/WAGON-573 (cd3bb5c)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                         | 2 +-
 wagon-provider-api/pom.xml                      | 2 +-
 wagon-provider-test/pom.xml                     | 2 +-
 wagon-providers/pom.xml                         | 2 +-
 wagon-providers/wagon-file/pom.xml              | 2 +-
 wagon-providers/wagon-ftp/pom.xml               | 2 +-
 wagon-providers/wagon-http-lightweight/pom.xml  | 2 +-
 wagon-providers/wagon-http-shared/pom.xml       | 2 +-
 wagon-providers/wagon-http/pom.xml              | 2 +-
 wagon-providers/wagon-scm/pom.xml               | 2 +-
 wagon-providers/wagon-ssh-common-test/pom.xml   | 2 +-
 wagon-providers/wagon-ssh-common/pom.xml        | 2 +-
 wagon-providers/wagon-ssh-external/pom.xml      | 2 +-
 wagon-providers/wagon-ssh/pom.xml               | 2 +-
 wagon-providers/wagon-webdav-jackrabbit/pom.xml | 2 +-
 wagon-tcks/pom.xml                              | 2 +-
 wagon-tcks/wagon-tck-http/pom.xml               | 2 +-
 17 files changed, 17 insertions(+), 17 deletions(-)


[maven-wagon] 01/01: [WAGON-573] EntityUtils.consumeQuietly() never called on non-2xx status codes

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch WAGON-573
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git

commit cd3bb5ccd33b1fe8670ceea24f553cc6dd00acbc
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Wed Oct 30 23:43:24 2019 +0100

    [WAGON-573] EntityUtils.consumeQuietly() never called on non-2xx status codes
---
 .../maven/wagon/shared/http/AbstractHttpClientWagon.java       | 10 +++++++++-
 .../java/org/apache/maven/wagon/providers/http/HttpWagon.java  |  5 +++++
 .../org/apache/maven/wagon/providers/webdav/WebDavWagon.java   |  2 ++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
index 3bf4291..dd1c690 100755
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/AbstractHttpClientWagon.java
@@ -798,25 +798,30 @@ public abstract class AbstractHttpClientWagon
                     case HttpStatus.SC_MOVED_PERMANENTLY: // 301
                     case HttpStatus.SC_MOVED_TEMPORARILY: // 302
                     case HttpStatus.SC_SEE_OTHER: // 303
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         put( resource, source, httpEntity, calculateRelocatedUrl( response ) );
                         return;
                     //case HttpStatus.SC_UNAUTHORIZED:
                     case HttpStatus.SC_FORBIDDEN:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         fireSessionConnectionRefused();
                         throw new AuthorizationException( formatAuthorizationMessage( url,
                                 response.getStatusLine().getStatusCode(),
                                 response.getStatusLine().getReasonPhrase(), getProxyInfo() ) );
 
                     case HttpStatus.SC_NOT_FOUND:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         throw new ResourceDoesNotExistException( formatResourceDoesNotExistMessage( url,
                                 response.getStatusLine().getStatusCode(),
                                 response.getStatusLine().getReasonPhrase(), getProxyInfo() ) );
 
                     case SC_TOO_MANY_REQUESTS:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         put( backoff( wait, url ), resource, source, httpEntity, url );
                         break;
                     //add more entries here
                     default:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         TransferFailedException e = new TransferFailedException( formatTransferFailedMessage( url,
                                 response.getStatusLine().getStatusCode(),
                                 response.getStatusLine().getReasonPhrase(), getProxyInfo() ) );
@@ -905,7 +910,6 @@ public abstract class AbstractHttpClientWagon
                                 response.getStatusLine().getReasonPhrase(), getProxyInfo() ) );
                 }
 
-                EntityUtils.consume( response.getEntity() );
                 return result;
             }
             finally
@@ -1176,22 +1180,26 @@ public abstract class AbstractHttpClientWagon
                 case HttpStatus.SC_FORBIDDEN:
                 case HttpStatus.SC_UNAUTHORIZED:
                 case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED:
+                    EntityUtils.consumeQuietly( response.getEntity() );
                     fireSessionConnectionRefused();
                     throw new AuthorizationException( formatAuthorizationMessage( url,
                             response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase(),
                             getProxyInfo() ) );
 
                 case HttpStatus.SC_NOT_FOUND:
+                    EntityUtils.consumeQuietly( response.getEntity() );
                     throw new ResourceDoesNotExistException( formatResourceDoesNotExistMessage( url,
                             response.getStatusLine().getStatusCode(),
                             response.getStatusLine().getReasonPhrase(), getProxyInfo() ) );
 
                 case SC_TOO_MANY_REQUESTS:
+                    EntityUtils.consumeQuietly( response.getEntity() );
                     fillInputData( backoff( wait, url ), inputData );
                     break;
 
                 // add more entries here
                 default:
+                    EntityUtils.consumeQuietly( response.getEntity() );
                     cleanupGetTransfer( resource );
                     TransferFailedException e = new TransferFailedException( formatTransferFailedMessage( url,
                             response.getStatusLine().getStatusCode(), response.getStatusLine().getReasonPhrase(),
diff --git a/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java b/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
index 9d53729..532141c 100755
--- a/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
+++ b/wagon-providers/wagon-http/src/main/java/org/apache/maven/wagon/providers/http/HttpWagon.java
@@ -24,6 +24,7 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpStatus;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.util.EntityUtils;
 import org.apache.maven.wagon.ResourceDoesNotExistException;
 import org.apache.maven.wagon.TransferFailedException;
 import org.apache.maven.wagon.authorization.AuthorizationException;
@@ -82,18 +83,22 @@ public class HttpWagon
                     case HttpStatus.SC_FORBIDDEN:
                     case HttpStatus.SC_UNAUTHORIZED:
                     case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         throw new AuthorizationException( HttpMessageUtils.formatAuthorizationMessage( url, statusCode,
                                 reasonPhrase, getProxyInfo() ) );
 
                     case HttpStatus.SC_NOT_FOUND:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         throw new ResourceDoesNotExistException( formatResourceDoesNotExistMessage( url, statusCode,
                                 reasonPhrase, getProxyInfo() ) );
 
                     case SC_TOO_MANY_REQUESTS:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         return getFileList( backoff( wait, url ), destinationDirectory );
 
                     //add more entries here
                     default:
+                        EntityUtils.consumeQuietly( response.getEntity() );
                         throw new TransferFailedException( formatTransferFailedMessage( url, statusCode, reasonPhrase,
                                 getProxyInfo() ) );
                 }
diff --git a/wagon-providers/wagon-webdav-jackrabbit/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java b/wagon-providers/wagon-webdav-jackrabbit/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java
index d991074..e7736b4 100644
--- a/wagon-providers/wagon-webdav-jackrabbit/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java
+++ b/wagon-providers/wagon-webdav-jackrabbit/src/main/java/org/apache/maven/wagon/providers/webdav/WebDavWagon.java
@@ -25,6 +25,7 @@ import org.apache.http.HttpStatus;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.impl.auth.BasicScheme;
+import org.apache.http.util.EntityUtils;
 import org.apache.jackrabbit.webdav.DavConstants;
 import org.apache.jackrabbit.webdav.DavException;
 import org.apache.jackrabbit.webdav.MultiStatus;
@@ -300,6 +301,7 @@ public class WebDavWagon
 
                 if ( closeableHttpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_FOUND )
                 {
+                    EntityUtils.consumeQuietly( closeableHttpResponse.getEntity() );
                     throw new ResourceDoesNotExistException( "Destination directory does not exist: " + url );
                 }
             }