You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/08/09 10:22:13 UTC

(maven-wagon) 02/02: Apply Spotless formatting

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

slachiewicz pushed a commit to branch feature/migrate-to-apache-http-client-5-x
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git

commit 40de5aae1d4ffc563a842bcb89e0f78d39a46cb1
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Aug 9 11:45:07 2026 +0200

    Apply Spotless formatting
---
 .../wagon/shared/http/AbstractHttpClientWagon.java | 98 ++++++++--------------
 .../maven/wagon/shared/http/BasicAuthScope.java    |  2 +-
 .../wagon/shared/http/ConfigurationUtils.java      |  2 +-
 .../StandardServiceUnavailableRetryStrategy.java   |  7 +-
 .../wagon/shared/http/WagonRedirectStrategy.java   | 17 ++--
 5 files changed, 50 insertions(+), 76 deletions(-)

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 6ee4c7dc..d7505ea7 100644
--- 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
@@ -45,54 +45,54 @@
 import java.util.concurrent.TimeUnit;
 
 import org.apache.hc.client5.http.HttpRequestRetryStrategy;
+import org.apache.hc.client5.http.ServiceUnavailableRetryStrategy;
 import org.apache.hc.client5.http.auth.AuthCache;
 import org.apache.hc.client5.http.auth.AuthSchemeFactory;
-import org.apache.hc.client5.http.auth.StandardAuthScheme;
-import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
-import org.apache.hc.core5.http.Header;
-import org.apache.hc.core5.http.HttpEntity;
-import org.apache.hc.core5.http.HttpException;
-import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.client5.http.auth.AuthScope;
 import org.apache.hc.client5.http.auth.ChallengeState;
 import org.apache.hc.client5.http.auth.Credentials;
 import org.apache.hc.client5.http.auth.CredentialsStore;
 import org.apache.hc.client5.http.auth.NTCredentials;
+import org.apache.hc.client5.http.auth.StandardAuthScheme;
 import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
-import org.apache.hc.client5.http.ServiceUnavailableRetryStrategy;
-import org.apache.hc.client5.http.config.CookieSpecs;
-import org.apache.hc.client5.http.config.RequestConfig;
 import org.apache.hc.client5.http.classic.methods.HttpGet;
 import org.apache.hc.client5.http.classic.methods.HttpHead;
 import org.apache.hc.client5.http.classic.methods.HttpPut;
 import org.apache.hc.client5.http.classic.methods.HttpUriRequest;
+import org.apache.hc.client5.http.config.CookieSpecs;
+import org.apache.hc.client5.http.config.RequestConfig;
 import org.apache.hc.client5.http.impl.auth.BasicAuthCache;
 import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
-import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-import org.apache.hc.client5.http.protocol.HttpClientContext;
-import org.apache.hc.core5.http.config.Registry;
-import org.apache.hc.core5.http.config.RegistryBuilder;
-import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
-import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory;
-import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
-import org.apache.hc.client5.http.utils.DateUtils;
-import org.apache.hc.core5.http.HttpHeaders;
-import org.apache.hc.core5.ssl.SSLContextBuilder;
-import org.apache.hc.core5.ssl.SSLInitializationException;
-import org.apache.hc.core5.http.io.entity.AbstractHttpEntity;
-import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.client5.http.impl.auth.BasicScheme;
 import org.apache.hc.client5.http.impl.auth.BasicSchemeFactory;
 import org.apache.hc.client5.http.impl.auth.DigestSchemeFactory;
 import org.apache.hc.client5.http.impl.auth.NTLMSchemeFactory;
 import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
 import org.apache.hc.client5.http.impl.classic.DefaultHttpRequestRetryHandler;
 import org.apache.hc.client5.http.impl.classic.DefaultServiceUnavailableRetryStrategy;
 import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
 import org.apache.hc.client5.http.impl.classic.StandardHttpRequestRetryHandler;
 import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
+import org.apache.hc.client5.http.io.HttpClientConnectionManager;
+import org.apache.hc.client5.http.protocol.HttpClientContext;
+import org.apache.hc.client5.http.socket.ConnectionSocketFactory;
+import org.apache.hc.client5.http.socket.PlainConnectionSocketFactory;
+import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
+import org.apache.hc.client5.http.utils.DateUtils;
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpEntity;
+import org.apache.hc.core5.http.HttpException;
+import org.apache.hc.core5.http.HttpHeaders;
+import org.apache.hc.core5.http.HttpHost;
+import org.apache.hc.core5.http.HttpStatus;
+import org.apache.hc.core5.http.config.Registry;
+import org.apache.hc.core5.http.config.RegistryBuilder;
+import org.apache.hc.core5.http.io.entity.AbstractHttpEntity;
+import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.http.message.BasicHeader;
+import org.apache.hc.core5.ssl.SSLContextBuilder;
+import org.apache.hc.core5.ssl.SSLInitializationException;
 import org.apache.maven.wagon.InputData;
 import org.apache.maven.wagon.OutputData;
 import org.apache.maven.wagon.PathUtils;
@@ -708,10 +708,7 @@ private void put(int wait, Resource resource, File source, HttpEntity httpEntity
             CloseableHttpResponse response = execute(putMethod);
             try {
                 fireTransferDebug(formatTransferDebugMessage(
-                        url,
-                        response.getCode(),
-                        response.getReasonPhrase(),
-                        getProxyInfo()));
+                        url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
                 int statusCode = response.getCode();
 
                 // Check that we didn't run out of retries.
@@ -730,19 +727,13 @@ private void put(int wait, Resource resource, File source, HttpEntity httpEntity
                         EntityUtils.consumeQuietly(response.getEntity());
                         fireSessionConnectionRefused();
                         throw new AuthorizationException(formatAuthorizationMessage(
-                                url,
-                                response.getCode(),
-                                response.getReasonPhrase(),
-                                getProxyInfo()));
+                                url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
 
                     case HttpStatus.SC_NOT_FOUND:
                     case HttpStatus.SC_GONE:
                         EntityUtils.consumeQuietly(response.getEntity());
                         throw new ResourceDoesNotExistException(formatResourceDoesNotExistMessage(
-                                url,
-                                response.getCode(),
-                                response.getReasonPhrase(),
-                                getProxyInfo()));
+                                url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
 
                     case SC_TOO_MANY_REQUESTS:
                         EntityUtils.consumeQuietly(response.getEntity());
@@ -752,10 +743,7 @@ private void put(int wait, Resource resource, File source, HttpEntity httpEntity
                     default:
                         EntityUtils.consumeQuietly(response.getEntity());
                         TransferFailedException e = new TransferFailedException(formatTransferFailedMessage(
-                                url,
-                                response.getCode(),
-                                response.getReasonPhrase(),
-                                getProxyInfo()));
+                                url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
                         fireTransferError(resource, e, TransferEvent.REQUEST_PUT);
                         throw e;
                 }
@@ -803,10 +791,7 @@ private boolean resourceExists(int wait, String resourceName)
                     case HttpStatus.SC_UNAUTHORIZED:
                     case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED:
                         throw new AuthorizationException(formatAuthorizationMessage(
-                                url,
-                                response.getCode(),
-                                response.getReasonPhrase(),
-                                getProxyInfo()));
+                                url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
 
                     case HttpStatus.SC_NOT_FOUND:
                     case HttpStatus.SC_GONE:
@@ -819,10 +804,7 @@ private boolean resourceExists(int wait, String resourceName)
                         // add more entries here
                     default:
                         throw new TransferFailedException(formatTransferFailedMessage(
-                                url,
-                                response.getCode(),
-                                response.getReasonPhrase(),
-                                getProxyInfo()));
+                                url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
                 }
 
                 return result;
@@ -1032,11 +1014,8 @@ private void fillInputData(int wait, InputData inputData)
             CloseableHttpResponse response = execute(getMethod);
             closeable = response;
 
-            fireTransferDebug(formatTransferDebugMessage(
-                    url,
-                    response.getCode(),
-                    response.getReasonPhrase(),
-                    getProxyInfo()));
+            fireTransferDebug(
+                    formatTransferDebugMessage(url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
             int statusCode = response.getCode();
 
             switch (statusCode) {
@@ -1054,19 +1033,13 @@ private void fillInputData(int wait, InputData inputData)
                     EntityUtils.consumeQuietly(response.getEntity());
                     fireSessionConnectionRefused();
                     throw new AuthorizationException(formatAuthorizationMessage(
-                            url,
-                            response.getCode(),
-                            response.getReasonPhrase(),
-                            getProxyInfo()));
+                            url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
 
                 case HttpStatus.SC_NOT_FOUND:
                 case HttpStatus.SC_GONE:
                     EntityUtils.consumeQuietly(response.getEntity());
                     throw new ResourceDoesNotExistException(formatResourceDoesNotExistMessage(
-                            url,
-                            response.getCode(),
-                            response.getReasonPhrase(),
-                            getProxyInfo()));
+                            url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
 
                 case SC_TOO_MANY_REQUESTS:
                     EntityUtils.consumeQuietly(response.getEntity());
@@ -1078,10 +1051,7 @@ private void fillInputData(int wait, InputData inputData)
                     EntityUtils.consumeQuietly(response.getEntity());
                     cleanupGetTransfer(resource);
                     TransferFailedException e = new TransferFailedException(formatTransferFailedMessage(
-                            url,
-                            response.getCode(),
-                            response.getReasonPhrase(),
-                            getProxyInfo()));
+                            url, response.getCode(), response.getReasonPhrase(), getProxyInfo()));
                     fireTransferError(resource, e, TransferEvent.REQUEST_GET);
                     throw e;
             }
diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/BasicAuthScope.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/BasicAuthScope.java
index 36aca02f..d7b7b026 100644
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/BasicAuthScope.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/BasicAuthScope.java
@@ -18,8 +18,8 @@
  */
 package org.apache.maven.wagon.shared.http;
 
-import org.apache.hc.core5.http.HttpHost;
 import org.apache.hc.client5.http.auth.AuthScope;
+import org.apache.hc.core5.http.HttpHost;
 
 /**
  * @since 2.8
diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/ConfigurationUtils.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/ConfigurationUtils.java
index 9719c14a..e2b8cb2b 100644
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/ConfigurationUtils.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/ConfigurationUtils.java
@@ -27,9 +27,9 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import org.apache.hc.client5.http.config.RequestConfig;
 import org.apache.hc.core5.http.Header;
 import org.apache.hc.core5.http.HttpHost;
-import org.apache.hc.client5.http.config.RequestConfig;
 import org.apache.hc.core5.http.message.BasicHeader;
 import org.apache.maven.wagon.Wagon;
 
diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/StandardServiceUnavailableRetryStrategy.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/StandardServiceUnavailableRetryStrategy.java
index 17ff1a0a..795ead86 100644
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/StandardServiceUnavailableRetryStrategy.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/StandardServiceUnavailableRetryStrategy.java
@@ -18,11 +18,11 @@
  */
 package org.apache.maven.wagon.shared.http;
 
-import org.apache.hc.core5.http.HttpStatus;
+import org.apache.hc.client5.http.ServiceUnavailableRetryStrategy;
 import org.apache.hc.core5.annotation.Contract;
 import org.apache.hc.core5.annotation.ThreadingBehavior;
 import org.apache.hc.core5.http.ClassicHttpResponse;
-import org.apache.hc.client5.http.ServiceUnavailableRetryStrategy;
+import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 
@@ -53,7 +53,8 @@ public StandardServiceUnavailableRetryStrategy(final int maxRetries, final int r
     }
 
     @Override
-    public boolean retryRequest(final ClassicHttpResponse response, final int executionCount, final HttpContext context) {
+    public boolean retryRequest(
+            final ClassicHttpResponse response, final int executionCount, final HttpContext context) {
         int statusCode = response.getCode();
         boolean retryableStatusCode = statusCode == HttpStatus.SC_REQUEST_TIMEOUT
                 // Too Many Requests ("standard" rate-limiting)
diff --git a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/WagonRedirectStrategy.java b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/WagonRedirectStrategy.java
index ffc417c0..6d9d85d2 100644
--- a/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/WagonRedirectStrategy.java
+++ b/wagon-providers/wagon-http-shared/src/main/java/org/apache/maven/wagon/shared/http/WagonRedirectStrategy.java
@@ -19,17 +19,18 @@
 package org.apache.maven.wagon.shared.http;
 
 import java.net.URI;
+
+import org.apache.hc.client5.http.classic.methods.HttpGet;
+import org.apache.hc.client5.http.classic.methods.HttpHead;
+import org.apache.hc.client5.http.classic.methods.HttpPut;
+import org.apache.hc.client5.http.classic.methods.HttpUriRequest;
 import org.apache.hc.client5.http.impl.DefaultRedirectStrategy;
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.ClassicHttpResponse;
 import org.apache.hc.core5.http.HttpEntityContainer;
-import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
 import org.apache.hc.core5.http.HttpStatus;
 import org.apache.hc.core5.http.ProtocolException;
-import org.apache.hc.client5.http.classic.methods.HttpGet;
-import org.apache.hc.client5.http.classic.methods.HttpHead;
-import org.apache.hc.client5.http.classic.methods.HttpPut;
-import org.apache.hc.client5.http.classic.methods.HttpUriRequest;
+import org.apache.hc.core5.http.io.support.ClassicRequestBuilder;
 import org.apache.hc.core5.http.protocol.HttpContext;
 import org.apache.hc.core5.util.Args;
 import org.apache.maven.wagon.events.TransferEvent;
@@ -63,7 +64,8 @@ public WagonRedirectStrategy() {
     }
 
     @Override
-    public boolean isRedirected(final ClassicHttpRequest request, final ClassicHttpResponse response, final HttpContext context)
+    public boolean isRedirected(
+            final ClassicHttpRequest request, final ClassicHttpResponse response, final HttpContext context)
             throws ProtocolException {
         Args.notNull(request, "HTTP request");
         Args.notNull(response, "HTTP response");
@@ -83,7 +85,8 @@ public boolean isRedirected(final ClassicHttpRequest request, final ClassicHttpR
     }
 
     @Override
-    public HttpUriRequest getRedirect(final ClassicHttpRequest request, final ClassicHttpResponse response, final HttpContext context)
+    public HttpUriRequest getRedirect(
+            final ClassicHttpRequest request, final ClassicHttpResponse response, final HttpContext context)
             throws ProtocolException {
         final URI uri = getLocationURI(request, response, context);
         if (request instanceof HttpEntityContainer) {