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

jinwoo pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 145d718f92 GEODE-10534: Fix Deprecated APIs in Support Modules 
(geode-management, geode-serialization, geode-deployment-legacy, geode-web-api) 
(#7983)
145d718f92 is described below

commit 145d718f92b59bd081c324de465a1882974d360d
Author: kaajaln2 <[email protected]>
AuthorDate: Mon Mar 23 14:00:29 2026 -0400

    GEODE-10534: Fix Deprecated APIs in Support Modules (geode-management, 
geode-serialization, geode-deployment-legacy, geode-web-api) (#7983)
    
    * GEODE-10534: Module 1:
    geode-management                
RestTemplateClusterManagementServiceTransport.java
    ○ Update RestTemplateClusterManagementServiceTransport to remove deprecated 
API usage
    ○ Replaced deprecated SSLConnectionSocketFactory with 
DefaultClientTlsStrategy and setSSLSocketFactory with setTlsSocketStrategy
    Issue 1.2: Apache Commons Lang StringUtils
      Index.java
         Updated removeStart with string manipulation code
    Module 2: geode-serialization
       DSFIDSerializerImpl.java
          Updated deprecated getProxyClass with newProxyInstance with a no-op 
handler
       Module 3: geode-deployment-legacy
          LegacyClasspathServiceImpl.java
              Refactor proxy class creation to avoid deprecated 
Proxy.getProxyClass usage
              Replaced usage of deprecated Proxy.getProxyClass with 
Proxy.newProxyInstance to obtain proxy class
     Module 4: geode-web-api
           SwaggerConfig.java
             No changes, can be updated when we move to Spring Framework 6.2+ 
with UrlHandlerFilter
    
    * Update DSFIDSerializerImpl.java
    
    fixed space format issue
---
 .../classloader/internal/LegacyClasspathServiceImpl.java   | 14 +++++++++++++-
 .../api/RestTemplateClusterManagementServiceTransport.java | 10 +++++-----
 .../org/apache/geode/management/configuration/Index.java   |  3 ++-
 .../serialization/internal/DSFIDSerializerImpl.java        |  6 ++++--
 .../rest/internal/web/swagger/config/SwaggerConfig.java    |  4 ++++
 5 files changed, 28 insertions(+), 9 deletions(-)

diff --git 
a/geode-deployment/geode-deployment-legacy/src/main/java/org/apache/geode/classloader/internal/LegacyClasspathServiceImpl.java
 
b/geode-deployment/geode-deployment-legacy/src/main/java/org/apache/geode/classloader/internal/LegacyClasspathServiceImpl.java
index 8bb116dbc3..993018d0da 100644
--- 
a/geode-deployment/geode-deployment-legacy/src/main/java/org/apache/geode/classloader/internal/LegacyClasspathServiceImpl.java
+++ 
b/geode-deployment/geode-deployment-legacy/src/main/java/org/apache/geode/classloader/internal/LegacyClasspathServiceImpl.java
@@ -21,6 +21,8 @@ import static java.util.stream.Collectors.joining;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -232,7 +234,17 @@ public class LegacyClasspathServiceImpl implements 
ClasspathService {
 
     for (ClassLoader classLoader : getClassLoaders()) {
       try {
-        return Proxy.getProxyClass(classLoader, classObjs);
+        // Proxy.getProxyClass is deprecated, so use the recommended way to 
create a proxy class.
+        // Only used to get the proxy class, so the handler can be a no-op.
+        InvocationHandler invocationHandler = new InvocationHandler() {
+          @Override
+          public Object invoke(Object proxy, Method method, Object[] 
methodArgs) {
+            return null;
+          }
+        };
+        // create a new Proxy instance to get the proxy class
+        Object proxy = Proxy.newProxyInstance(classLoader, classObjs, 
invocationHandler);
+        return proxy.getClass();
       } catch (SecurityException sex) {
         // Continue to next classloader
       } catch (IllegalArgumentException iaex) {
diff --git 
a/geode-management/src/main/java/org/apache/geode/management/api/RestTemplateClusterManagementServiceTransport.java
 
b/geode-management/src/main/java/org/apache/geode/management/api/RestTemplateClusterManagementServiceTransport.java
index dcb01f4689..dc14b4994e 100644
--- 
a/geode-management/src/main/java/org/apache/geode/management/api/RestTemplateClusterManagementServiceTransport.java
+++ 
b/geode-management/src/main/java/org/apache/geode/management/api/RestTemplateClusterManagementServiceTransport.java
@@ -30,7 +30,7 @@ import javax.net.ssl.SSLContext;
 import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
 import 
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
 import org.apache.hc.client5.http.io.HttpClientConnectionManager;
-import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
+import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
@@ -164,13 +164,13 @@ public class RestTemplateClusterManagementServiceTransport
     // Configure SSL context and hostname verifier (HttpClient 5.x approach)
     // Only configure SSL if we have a non-null SSL context
     if (connectionConfig.getSslContext() != null) {
-      SSLConnectionSocketFactory sslSocketFactory = new 
SSLConnectionSocketFactory(
+      DefaultClientTlsStrategy sslSocketFactory = new DefaultClientTlsStrategy(
           connectionConfig.getSslContext(),
           connectionConfig.getHostnameVerifier());
 
       HttpClientConnectionManager connectionManager =
           PoolingHttpClientConnectionManagerBuilder.create()
-              .setSSLSocketFactory(sslSocketFactory)
+              .setTlsSocketStrategy(sslSocketFactory)
               .build();
 
       clientBuilder.setConnectionManager(connectionManager);
@@ -178,13 +178,13 @@ public class RestTemplateClusterManagementServiceTransport
       // If only hostname verifier is set without SSL context, we need to use 
the default SSL
       // context
       try {
-        SSLConnectionSocketFactory sslSocketFactory = new 
SSLConnectionSocketFactory(
+        DefaultClientTlsStrategy sslSocketFactory = new 
DefaultClientTlsStrategy(
             SSLContext.getDefault(),
             connectionConfig.getHostnameVerifier());
 
         HttpClientConnectionManager connectionManager =
             PoolingHttpClientConnectionManagerBuilder.create()
-                .setSSLSocketFactory(sslSocketFactory)
+                .setTlsSocketStrategy(sslSocketFactory)
                 .build();
 
         clientBuilder.setConnectionManager(connectionManager);
diff --git 
a/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java
 
b/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java
index 2e1c684916..03372f9168 100644
--- 
a/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java
+++ 
b/geode-management/src/main/java/org/apache/geode/management/configuration/Index.java
@@ -88,7 +88,8 @@ public class Index extends AbstractConfiguration<IndexInfo> 
implements RegionSco
     }
 
     String regionName = regionPath.trim().split(" ")[0];
-    regionName = StringUtils.removeStart(regionName, SEPARATOR);
+    regionName =
+        regionName.startsWith(SEPARATOR) ? 
regionName.substring(SEPARATOR.length()) : regionName;
     if (regionName.contains(".")) {
       regionName = regionName.substring(0, regionName.indexOf('.'));
     }
diff --git 
a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/internal/DSFIDSerializerImpl.java
 
b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/internal/DSFIDSerializerImpl.java
index beb9eb0020..a69756fc4c 100644
--- 
a/geode-serialization/src/main/java/org/apache/geode/internal/serialization/internal/DSFIDSerializerImpl.java
+++ 
b/geode-serialization/src/main/java/org/apache/geode/internal/serialization/internal/DSFIDSerializerImpl.java
@@ -340,9 +340,11 @@ public class DSFIDSerializerImpl implements 
DSFIDSerializer {
     try {
       Constructor<?> cons = fixedIdClass.getConstructor((Class<Object>[]) 
null);
       cons.setAccessible(true);
-      if (!cons.isAccessible()) {
+      // Based on canAccess doc - since this is constructor, the obj must be 
null
+      if (!cons.canAccess(null)) {
         throw new IllegalArgumentException(
-            "default constructor not accessible " + "for DSFID=" + fixedId + 
": " + fixedIdClass);
+            "default constructor failed reflective access check (canAccess) 
for DSFID="
+                + fixedId + ": " + fixedIdClass);
       }
       if (fixedId >= Byte.MIN_VALUE && fixedId <= Byte.MAX_VALUE) {
         int index = fixedId + Byte.MAX_VALUE + 1;
diff --git 
a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
 
b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
index 43b007b5c4..b24aa97368 100644
--- 
a/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
+++ 
b/geode-web-api/src/main/java/org/apache/geode/rest/internal/web/swagger/config/SwaggerConfig.java
@@ -59,6 +59,10 @@ public class SwaggerConfig implements 
WebApplicationInitializer, WebMvcConfigure
   @Override
   public void configurePathMatch(PathMatchConfigurer configurer) {
     PathPatternParser parser = new PathPatternParser();
+    // When Geode requires Spring Framework 6.2+ as a minimum, this explicit 
PathPatternParser
+    // configuration for optional trailing slashes can be replaced by 
configuring UrlHandlerFilter
+    // (e.g., via a filter registration or equivalent configuration) to handle 
trailing-slash
+    // matching instead of customize it here in configurePathMatch.
     parser.setMatchOptionalTrailingSeparator(true);
     configurer.setPatternParser(parser);
   }

Reply via email to