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 07f41304 Reduce deprecated calls in 
org.apache.commons.vfs2.provider.http5
07f41304 is described below

commit 07f41304143cbc587fa4308fc5a101e47e49f913
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Sep 21 15:01:15 2023 -0400

    Reduce deprecated calls in org.apache.commons.vfs2.provider.http5
---
 .../commons/vfs2/provider/http5/Http5FileObject.java    |  2 +-
 .../commons/vfs2/provider/http5/Http5FileProvider.java  | 17 +++++++----------
 src/changes/changes.xml                                 |  3 +++
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java
index ac35fa5e..598ff83f 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileObject.java
@@ -144,7 +144,7 @@ public class Http5FileObject<FS extends Http5FileSystem> 
extends AbstractFileObj
 
         FileSystemException.requireNonNull(header, 
"vfs.provider.http/last-modified.error", getName());
 
-        return DateUtils.parseDate(header.getValue()).getTime();
+        return DateUtils.parseStandardDate(header.getValue()).toEpochMilli();
     }
 
     @Override
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
index a1d9284a..a8fac814 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
@@ -50,7 +50,7 @@ import org.apache.hc.client5.http.auth.AuthCache;
 import org.apache.hc.client5.http.auth.AuthScope;
 import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
 import org.apache.hc.client5.http.classic.HttpClient;
-import org.apache.hc.client5.http.config.RequestConfig;
+import org.apache.hc.client5.http.config.ConnectionConfig;
 import org.apache.hc.client5.http.cookie.BasicCookieStore;
 import org.apache.hc.client5.http.cookie.Cookie;
 import org.apache.hc.client5.http.cookie.CookieStore;
@@ -119,10 +119,14 @@ public class Http5FileProvider extends 
AbstractOriginatingFileProvider {
     private HttpClientConnectionManager createConnectionManager(final 
Http5FileSystemConfigBuilder builder,
             final FileSystemOptions fileSystemOptions) throws 
FileSystemException {
 
+        final ConnectionConfig connectionConfig = ConnectionConfig.custom()
+                
.setConnectTimeout(Timeout.of(builder.getSoTimeoutDuration(fileSystemOptions)))
+                .build();
+
         final SocketConfig socketConfig =
                 SocketConfig
                 .custom()
-                
.setSoTimeout(Timeout.ofMilliseconds(builder.getSoTimeoutDuration(fileSystemOptions).toMillis()))
+                
.setSoTimeout(Timeout.of(builder.getSoTimeoutDuration(fileSystemOptions)))
                 .build();
 
         final String[] tlsVersions = 
builder.getTlsVersions(fileSystemOptions).split("\\s*,\\s*");
@@ -136,6 +140,7 @@ public class Http5FileProvider extends 
AbstractOriginatingFileProvider {
                 .build();
 
         return PoolingHttpClientConnectionManagerBuilder.create()
+                .setDefaultConnectionConfig(connectionConfig)
                 .setSSLSocketFactory(sslSocketFactory)
                 
.setMaxConnTotal(builder.getMaxTotalConnections(fileSystemOptions))
                 
.setMaxConnPerRoute(builder.getMaxConnectionsPerHost(fileSystemOptions))
@@ -155,13 +160,6 @@ public class Http5FileProvider extends 
AbstractOriginatingFileProvider {
         return cookieStore;
     }
 
-    private RequestConfig createDefaultRequestConfig(final 
Http5FileSystemConfigBuilder builder,
-            final FileSystemOptions fileSystemOptions) {
-        return RequestConfig.custom()
-                
.setConnectTimeout(Timeout.ofMilliseconds(builder.getSoTimeoutDuration(fileSystemOptions).toMillis()))
-                .build();
-    }
-
     private HostnameVerifier createHostnameVerifier(final 
Http5FileSystemConfigBuilder builder, final FileSystemOptions 
fileSystemOptions) {
         if (!builder.isHostnameVerificationEnabled(fileSystemOptions)) {
             return NoopHostnameVerifier.INSTANCE;
@@ -206,7 +204,6 @@ public class Http5FileProvider extends 
AbstractOriginatingFileProvider {
                 .setRoutePlanner(createHttpRoutePlanner(builder, 
fileSystemOptions))
                 .setConnectionManager(createConnectionManager(builder, 
fileSystemOptions))
                 .setConnectionReuseStrategy(connectionReuseStrategy)
-                .setDefaultRequestConfig(createDefaultRequestConfig(builder, 
fileSystemOptions))
                 .setDefaultHeaders(defaultHeaders)
                 .setDefaultCookieStore(createDefaultCookieStore(builder, 
fileSystemOptions));
 
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 744cba52..490f6ae4 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -154,6 +154,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">
         Don't use deprecated methods in 
org.apache.commons.vfs2.provider.ftp.FtpClientFactory.
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        Reduce deprecated calls in org.apache.commons.vfs2.provider.http5.
+      </action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Seth Falco">
         Add vscode files to gitignore #205.

Reply via email to