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

markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new e1b65911c4 Fix Gump failures
e1b65911c4 is described below

commit e1b65911c435de0dd6917afff0f90e15784e2651
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Nov 27 10:06:38 2026 +0000

    Fix Gump failures
    
    Adds a Java 25 check to JreCompat
---
 .../org/apache/tomcat/util/compat/Jre25Compat.java | 57 ++++++++++++++++++++++
 java/org/apache/tomcat/util/compat/JreCompat.java  | 35 ++++++++++++-
 .../tomcat/util/compat/LocalStrings.properties     |  2 +
 .../tribes/group/TestGroupChannelTlsFFM.java       |  2 +-
 4 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre25Compat.java 
b/java/org/apache/tomcat/util/compat/Jre25Compat.java
new file mode 100644
index 0000000000..6447832f26
--- /dev/null
+++ b/java/org/apache/tomcat/util/compat/Jre25Compat.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.compat;
+
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.util.res.StringManager;
+
+/**
+ * JRE 25 compatibility implementation.
+ */
+public class Jre25Compat extends Jre22Compat {
+
+    /**
+     * Constructs a new Jre25Compat.
+     */
+    public Jre25Compat() {
+    }
+
+    private static final Log log = LogFactory.getLog(Jre25Compat.class);
+    private static final StringManager sm = 
StringManager.getManager(Jre25Compat.class);
+
+    private static final boolean supported;
+
+
+    static {
+        // java.lang.IO is the only new class in Java 25 that was not present 
in Java 24.
+        Class<?> c1 = null;
+        try {
+            c1 = Class.forName("java.textlang.IO");
+        } catch (ClassNotFoundException e) {
+            // Must be pre-Java 25
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("jre25Compat.javaPre25"), e);
+            }
+        }
+        supported = (c1 != null);
+    }
+
+    static boolean isSupported() {
+        return supported;
+    }
+}
diff --git a/java/org/apache/tomcat/util/compat/JreCompat.java 
b/java/org/apache/tomcat/util/compat/JreCompat.java
index ff94a26c0b..b71a052cc3 100644
--- a/java/org/apache/tomcat/util/compat/JreCompat.java
+++ b/java/org/apache/tomcat/util/compat/JreCompat.java
@@ -72,6 +72,7 @@ public class JreCompat {
     private static final boolean jre20Available;
     private static final boolean jre21Available;
     private static final boolean jre22Available;
+    private static final boolean jre25Available;
 
     protected static final String USE_CANON_CACHES_CMD_ARG = 
"-Dsun.io.useCanonCaches=";
     protected static volatile Boolean canonCachesDisabled;
@@ -95,8 +96,21 @@ public class JreCompat {
 
         // This is Tomcat 9 with a minimum Java version of Java 8.
         // Look for the highest supported JVM first
-        if (Jre22Compat.isSupported()) {
+        if (Jre25Compat.isSupported()) {
+            instance = new Jre25Compat();
+            jre25Available = true;
+            jre22Available = true;
+            jre21Available = true;
+            jre20Available = true;
+            jre19Available = true;
+            jre17Available = true;
+            jre16Available = true;
+            jre12Available = true;
+            jre11Available = true;
+            jre9Available = true;
+        } else if (Jre22Compat.isSupported()) {
             instance = new Jre22Compat();
+            jre25Available = false;
             jre22Available = true;
             jre21Available = true;
             jre20Available = true;
@@ -108,6 +122,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre21Compat.isSupported()) {
             instance = new Jre21Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = true;
             jre20Available = true;
@@ -119,6 +134,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre20Compat.isSupported()) {
             instance = new Jre20Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = true;
@@ -130,6 +146,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre19Compat.isSupported()) {
             instance = new Jre19Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = false;
@@ -141,6 +158,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre17Compat.isSupported()) {
             instance = new Jre17Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = false;
@@ -152,6 +170,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre16Compat.isSupported()) {
             instance = new Jre16Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = false;
@@ -163,6 +182,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre12Compat.isSupported()) {
             instance = new Jre12Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = false;
@@ -174,6 +194,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre11Compat.isSupported()) {
             instance = new Jre11Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = false;
@@ -185,6 +206,7 @@ public class JreCompat {
             jre9Available = true;
         } else if (Jre9Compat.isSupported()) {
             instance = new Jre9Compat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = false;
@@ -196,6 +218,7 @@ public class JreCompat {
             jre9Available = true;
         } else {
             instance = new JreCompat();
+            jre25Available = false;
             jre22Available = false;
             jre21Available = false;
             jre20Available = false;
@@ -295,6 +318,16 @@ public class JreCompat {
     }
 
 
+    /**
+     * Check if JRE 25 is available.
+     *
+     * @return {@code true} if JRE 25 is available
+     */
+    public static boolean isJre25Available() {
+        return jre25Available;
+    }
+
+
     // Java 8 implementation of Java 9 methods
 
     /**
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings.properties 
b/java/org/apache/tomcat/util/compat/LocalStrings.properties
index 56370ab9cf..7f9e77050e 100644
--- a/java/org/apache/tomcat/util/compat/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/compat/LocalStrings.properties
@@ -31,6 +31,8 @@ jre21Compat.unexpected=Failed to create references to Java 21 
classes and method
 jre22Compat.javaPre22=Class not found so assuming code is running on a 
pre-Java 22 JVM
 jre22Compat.unexpected=Failed to create references to Java 22 classes and 
methods
 
+jre25Compat.javaPre25=Class not found so assuming code is running on a 
pre-Java 25 JVM
+
 jre9Compat.invalidModuleUri=The module URI provided [{0}] could not be 
converted to a URL for the JarScanner to process
 jre9Compat.javaPre9=Class not found so assuming code is running on a pre-Java 
9 JVM
 jre9Compat.unexpected=Failed to create references to Java 9 classes and methods
diff --git a/test/org/apache/catalina/tribes/group/TestGroupChannelTlsFFM.java 
b/test/org/apache/catalina/tribes/group/TestGroupChannelTlsFFM.java
index df6c1036e3..6a386fe6f0 100644
--- a/test/org/apache/catalina/tribes/group/TestGroupChannelTlsFFM.java
+++ b/test/org/apache/catalina/tribes/group/TestGroupChannelTlsFFM.java
@@ -31,7 +31,7 @@ public class TestGroupChannelTlsFFM extends 
GroupChannelTlsTestBase {
 
     @Before
     public void setup() throws Exception {
-        Assume.assumeTrue("FFM requires Java 22+", 
JreCompat.isJre22Available());
+        Assume.assumeTrue("FFM support is compiled with Java 25+", 
JreCompat.isJre25Available());
         try {
             openSSLLibraryInit();
         } catch (Throwable t) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to