You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@creadur.apache.org by po...@apache.org on 2026/07/17 09:38:48 UTC

(creadur-tentacles) branch feature/TENTACLES-26 created (now ccc84bc)

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

ottlinger pushed a change to branch feature/TENTACLES-26
in repository https://gitbox.apache.org/repos/asf/creadur-tentacles.git


      at ccc84bc  TENTACLES-26: Update to httpclient5 and fix security warnings

This branch includes the following new commits:

     new ccc84bc  TENTACLES-26: Update to httpclient5 and fix security warnings

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.



(creadur-tentacles) 01/01: TENTACLES-26: Update to httpclient5 and fix security warnings

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

ottlinger pushed a commit to branch feature/TENTACLES-26
in repository https://gitbox.apache.org/repos/asf/creadur-tentacles.git

commit ccc84bcf59e6a4b76c0a909fd1ae80bfb627dc8b
Author: P. Ottlinger <po...@apache.org>
AuthorDate: Fri Jul 17 11:38:39 2026 +0200

    TENTACLES-26: Update to httpclient5 and fix security warnings
---
 pom.xml                                            |  6 ++--
 .../org/apache/creadur/tentacles/NexusClient.java  | 32 ++++++++++++----------
 2 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0bc5053..a8c993c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,8 +35,8 @@
       <version>2.1.0</version>
     </dependency>
     <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
+      <groupId>org.apache.httpcomponents.client5</groupId>
+      <artifactId>httpclient5</artifactId>
       <version>${httpClientVersion}</version>
     </dependency>
     <dependency>
@@ -94,7 +94,7 @@
     <previousTentaclesVersion>0.1</previousTentaclesVersion>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <javaVersion>17</javaVersion>
-    <httpClientVersion>4.5.14</httpClientVersion>
+    <httpClientVersion>5.6.2</httpClientVersion>
     <loggerVersion>2.26.1</loggerVersion>
     <apacheRatVersion>0.18</apacheRatVersion>
     <!-- taken from https://maven.apache.org/guides/mini/guide-reproducible-builds.html, updated by maven-release-plugin -->
diff --git a/src/main/java/org/apache/creadur/tentacles/NexusClient.java b/src/main/java/org/apache/creadur/tentacles/NexusClient.java
index 0fc43bb..465d6b9 100644
--- a/src/main/java/org/apache/creadur/tentacles/NexusClient.java
+++ b/src/main/java/org/apache/creadur/tentacles/NexusClient.java
@@ -16,15 +16,17 @@
  */
 package org.apache.creadur.tentacles;
 
-import org.apache.http.Header;
-import org.apache.http.HttpHeaders;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpHead;
-import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.logging.log4j.*;
+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.HttpUriRequest;
+import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
+import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
+import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.Header;
+import org.apache.hc.core5.http.HttpHeaders;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
 import org.codehaus.swizzle.stream.StreamLexer;
 
 import java.io.File;
@@ -74,7 +76,7 @@ public class NexusClient {
 
         log.info("Download {}", uri);
 
-        try (CloseableHttpResponse response = get(uri); InputStream content = response.getEntity().getContent()) {
+        try (ClassicHttpResponse response = get(uri); InputStream content = response.getEntity().getContent()) {
 
             this.fileSystem.mkparent(file);
 
@@ -85,7 +87,7 @@ public class NexusClient {
     }
 
     private Long getContentLength(final URI uri) throws IOException {
-        final CloseableHttpResponse head = head(uri);
+        final ClassicHttpResponse head = head(uri);
         final Header[] headers = head.getHeaders(HttpHeaders.CONTENT_LENGTH);
 
         if (headers != null && headers.length >= 1) {
@@ -97,15 +99,15 @@ public class NexusClient {
         return (long) -1;
     }
 
-    private CloseableHttpResponse get(final URI uri) throws IOException {
+    private ClassicHttpResponse get(final URI uri) throws IOException {
         return get(new HttpGet(uri), this.retries);
     }
 
-    private CloseableHttpResponse head(final URI uri) throws IOException {
+    private ClassicHttpResponse head(final URI uri) throws IOException {
         return get(new HttpHead(uri), this.retries);
     }
 
-    private CloseableHttpResponse get(final HttpUriRequest request, int tries) throws IOException {
+    private ClassicHttpResponse get(final HttpUriRequest request, int tries) throws IOException {
         try {
             request.setHeader(HttpHeaders.USER_AGENT, USER_AGENT_CONTENTS);
             return this.client.execute(request);
@@ -128,7 +130,7 @@ public class NexusClient {
         log.info("Crawl {}", index);
         final Set<URI> resources = new LinkedHashSet<>();
 
-        final CloseableHttpResponse response = get(index);
+        final ClassicHttpResponse response = get(index);
 
         final InputStream content = response.getEntity().getContent();
         final StreamLexer lexer = new StreamLexer(content);