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

okumin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 4bdd0f19875 HIVE-29047: Adjust httpclient5 httpcore dependencies in 
TestHttpServices (#5907)
4bdd0f19875 is described below

commit 4bdd0f19875833d52c00e83d2ead6d557f31e7f1
Author: richardantal <antal97rich...@gmail.com>
AuthorDate: Wed Jul 2 03:46:52 2025 +0200

    HIVE-29047: Adjust httpclient5 httpcore dependencies in TestHttpServices 
(#5907)
    
    added restriction for the imports too
    
    Co-authored-by: Richard Antal <richard.an...@cloudera.com>
---
 .../test/java/org/apache/hive/service/TestHttpServices.java  | 12 ++++++------
 pom.xml                                                      |  9 +++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git 
a/itests/hive-unit/src/test/java/org/apache/hive/service/TestHttpServices.java 
b/itests/hive-unit/src/test/java/org/apache/hive/service/TestHttpServices.java
index 9aa0e260f15..d4f9ab1fc6a 100644
--- 
a/itests/hive-unit/src/test/java/org/apache/hive/service/TestHttpServices.java
+++ 
b/itests/hive-unit/src/test/java/org/apache/hive/service/TestHttpServices.java
@@ -20,11 +20,11 @@
 
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
-import org.apache.hc.client5.http.classic.methods.HttpGet;
-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.HttpClients;
-import org.apache.hc.core5.http.Header;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.Header;
 import org.apache.hive.jdbc.miniHS2.MiniHS2;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -83,7 +83,7 @@ private void 
testHttpServiceDoesNotContainServerVersionAndXPoweredBy(String mini
       HttpGet request = new HttpGet(miniHS2);
 
       try (CloseableHttpResponse response = httpClient.execute(request)) {
-        for (Header header : response.getHeaders()) {
+        for (Header header : response.getAllHeaders()) {
           Assert.assertNotEquals("x-powered-by", 
header.getName().toLowerCase());
           Assert.assertNotEquals("server", header.getName().toLowerCase());
         }
diff --git a/pom.xml b/pom.xml
index 3894c9e3c6d..5505d46d92b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1733,6 +1733,15 @@
                   </bannedImports>
                   <includeTestCode>true</includeTestCode>
                 </restrictImports>
+                <!-- To prevent unintentional usage of HTTP Components 5, 
e.g., via transitive dependencies -->
+                <restrictImports 
implementation="de.skuzzle.enforcer.restrictimports.RestrictImports">
+                  <reason>Do not use httpcore5/httpclient5 classes until Hive 
is not upgraded to httpcore5/httpclient5</reason>
+                  <bannedImports>
+                    <bannedImport>org.apache.hc.client5.**</bannedImport>
+                    <bannedImport>org.apache.hc.core5.**</bannedImport>
+                  </bannedImports>
+                  <includeTestCode>true</includeTestCode>
+                </restrictImports>
               </rules>
             </configuration>
           </execution>

Reply via email to