You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/10/01 14:14:42 UTC
[tomcat] branch master updated: Try and detect bugs like BZ 63778
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 504c3e7 Try and detect bugs like BZ 63778
504c3e7 is described below
commit 504c3e7a3227ba637f1f88dbcdc3ff0c4d76a75c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Oct 1 15:14:08 2019 +0100
Try and detect bugs like BZ 63778
---
java/org/apache/tomcat/util/compat/Jre9Compat.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/tomcat/util/compat/Jre9Compat.java b/java/org/apache/tomcat/util/compat/Jre9Compat.java
index 0987ff0..843c0e3 100644
--- a/java/org/apache/tomcat/util/compat/Jre9Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre9Compat.java
@@ -77,6 +77,10 @@ class Jre9Compat extends JreCompat {
Object o15 = null;
try {
+ // Order is important for the error handling below.
+ // Must look up c1 first.
+ c1 = Class.forName("java.lang.reflect.InaccessibleObjectException");
+
Class<?> moduleLayerClazz = Class.forName("java.lang.ModuleLayer");
Class<?> configurationClazz = Class.forName("java.lang.module.Configuration");
Class<?> resolvedModuleClazz = Class.forName("java.lang.module.ResolvedModule");
@@ -86,7 +90,6 @@ class Jre9Compat extends JreCompat {
Method runtimeVersionMethod = JarFile.class.getMethod("runtimeVersion");
Method majorMethod = versionClazz.getMethod("major");
- c1 = Class.forName("java.lang.reflect.InaccessibleObjectException");
m2 = SSLParameters.class.getMethod("setApplicationProtocols", String[].class);
m3 = SSLEngine.class.getMethod("getApplicationProtocol");
m4 = URLConnection.class.getMethod("setDefaultUseCaches", String.class, boolean.class);
@@ -103,8 +106,13 @@ class Jre9Compat extends JreCompat {
o15 = majorMethod.invoke(o14);
} catch (ClassNotFoundException e) {
- // Must be pre-Java 9
- log.debug(sm.getString("jre9Compat.javaPre9"), e);
+ if (c1 == null) {
+ // Must be pre-Java 9
+ log.debug(sm.getString("jre9Compat.javaPre9"), e);
+ } else {
+ // Should never happen - signature error in lookup?
+ log.error(sm.getString("jre9Compat.unexpected"), e);
+ }
} catch (ReflectiveOperationException | IllegalArgumentException e) {
// Should never happen
log.error(sm.getString("jre9Compat.unexpected"), e);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org