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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 6fea720853 Better warning for Java 18 to 20
6fea720853 is described below

commit 6fea720853201693e0b5d135180f4e3a87d42d9d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Feb 21 18:10:13 2025 +0000

    Better warning for Java 18 to 20
---
 java/org/apache/tomcat/util/compat/Jre12Compat.java        | 4 ++++
 java/org/apache/tomcat/util/compat/LocalStrings.properties | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre12Compat.java 
b/java/org/apache/tomcat/util/compat/Jre12Compat.java
index e89499c291..3321835ac8 100644
--- a/java/org/apache/tomcat/util/compat/Jre12Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre12Compat.java
@@ -134,6 +134,10 @@ public class Jre12Compat extends JreCompat {
                 Lookup lookup = MethodHandles.privateLookupIn(Field.class, 
MethodHandles.lookup());
                 VarHandle modifiers = lookup.findVarHandle(Field.class, 
"modifiers", int.class);
                 modifiers.set(f, f.getModifiers() & ~Modifier.FINAL);
+            } catch (UnsupportedOperationException e) {
+                // Make sure field is not set.
+                f = null;
+                log.warn(sm.getString("jreCompat.useCanonCaches.java18"), e);
             } catch (InaccessibleObjectException | 
ReflectiveOperationException | IllegalArgumentException e) {
                 // Make sure field is not set.
                 f = null;
diff --git a/java/org/apache/tomcat/util/compat/LocalStrings.properties 
b/java/org/apache/tomcat/util/compat/LocalStrings.properties
index 5f8bdaefb2..88cc317659 100644
--- a/java/org/apache/tomcat/util/compat/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/compat/LocalStrings.properties
@@ -35,4 +35,5 @@ jreCompat.noUnixDomainSocket=Java Runtime does not support 
Unix domain sockets.
 jreCompat.noVirtualThreads=Java Runtime does not support virtual threads. You 
must use Java 21 or later to use this feature.
 jreCompat.useCanonCaches.failed=Failed to set the 
java.io.FileSystem.useCanonCaches static field
 jreCompat.useCanonCaches.init=Unable to create a reference to the 
java.io.FileSystem.useCanonCaches static field
-jreCompat.useCanonCaches.none=No reference to the 
java.io.FileSystem.useCanonCaches static field available. Enable debug logging 
for more information.
+jreCompat.useCanonCaches.java18=If using Java 18 to Java 20 inclusive, you 
must not enabled the canonical file name cache using 
-Dsun.io.useCanonCaches=true on the command line as Tomcat is unable to disable 
the cache via reflection on those Java versions
+jreCompat.useCanonCaches.none=No reference to the 
java.io.FileSystem.useCanonCaches static field available


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to