This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 21a6cac Remove use of JreCompat as it is not required with Java 11+
21a6cac is described below
commit 21a6cac161e8f6097d119a41611793ea022c9e09
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jul 28 13:35:27 2021 +0100
Remove use of JreCompat as it is not required with Java 11+
---
.../catalina/loader/WebappClassLoaderBase.java | 49 +++++++---------------
1 file changed, 14 insertions(+), 35 deletions(-)
diff --git a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
index 3b63625..b082861 100644
--- a/java/org/apache/catalina/loader/WebappClassLoaderBase.java
+++ b/java/org/apache/catalina/loader/WebappClassLoaderBase.java
@@ -26,6 +26,7 @@ import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.lang.ref.Reference;
import java.lang.reflect.Field;
+import java.lang.reflect.InaccessibleObjectException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
@@ -2054,19 +2055,14 @@ public abstract class WebappClassLoaderBase extends
URLClassLoader
}
}
}
+ } catch (InaccessibleObjectException e) {
+ // Must be running on without the necessary command line options.
+ log.warn(sm.getString("webappClassLoader.addExportsThreadLocal",
this.getClass().getModule().getName()));
} catch (Throwable t) {
- JreCompat jreCompat = JreCompat.getInstance();
- if (jreCompat.isInstanceOfInaccessibleObjectException(t)) {
- // Must be running on Java 9 without the necessary command line
- // options.
- String currentModule =
JreCompat.getInstance().getModuleName(this.getClass());
-
log.warn(sm.getString("webappClassLoader.addExportsThreadLocal",
currentModule));
- } else {
- ExceptionUtils.handleThrowable(t);
- log.warn(sm.getString(
- "webappClassLoader.checkThreadLocalsForLeaksFail",
- getContextName()), t);
- }
+ ExceptionUtils.handleThrowable(t);
+ log.warn(sm.getString(
+ "webappClassLoader.checkThreadLocalsForLeaksFail",
+ getContextName()), t);
}
}
@@ -2317,17 +2313,9 @@ public abstract class WebappClassLoaderBase extends
URLClassLoader
IllegalAccessException e) {
log.warn(sm.getString("webappClassLoader.clearRmiFail",
getContextName()), e);
- } catch (Exception e) {
- JreCompat jreCompat = JreCompat.getInstance();
- if (jreCompat.isInstanceOfInaccessibleObjectException(e)) {
- // Must be running on Java 9 without the necessary command line
- // options.
- String currentModule =
JreCompat.getInstance().getModuleName(this.getClass());
- log.warn(sm.getString("webappClassLoader.addExportsRmi",
currentModule));
- } else {
- // Re-throw all other exceptions
- throw e;
- }
+ } catch (InaccessibleObjectException e) {
+ // Must be running on without the necessary command line options.
+ log.warn(sm.getString("webappClassLoader.addExportsRmi",
this.getClass().getModule().getName()));
}
}
@@ -2340,18 +2328,9 @@ public abstract class WebappClassLoaderBase extends
URLClassLoader
} catch (ReflectiveOperationException | SecurityException |
ClassCastException e) {
log.warn(sm.getString(
"webappClassLoader.clearObjectStreamClassCachesFail",
getContextName()), e);
- } catch (Exception e) {
- JreCompat jreCompat = JreCompat.getInstance();
- if (jreCompat.isInstanceOfInaccessibleObjectException(e)) {
- // Must be running on Java 9 without the necessary command line
- // options.
- String currentModule =
JreCompat.getInstance().getModuleName(this.getClass());
- log.warn(sm.getString("webappClassLoader.addExportsJavaIo",
currentModule));
- return;
- } else {
- // Re-throw all other exceptions
- throw e;
- }
+ } catch (InaccessibleObjectException e) {
+ // Must be running on without the necessary command line options.
+ log.warn(sm.getString("webappClassLoader.addExportsJavaIo",
this.getClass().getModule().getName()));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]