This is an automated email from the ASF dual-hosted git repository.
markt 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 2fb40d5d54 Better fix for --enable-preview errors. Suggested by Alan
Bateman
2fb40d5d54 is described below
commit 2fb40d5d549598840ae4ffbad6c13eee29dfc7c3
Author: Mark Thomas <[email protected]>
AuthorDate: Tue May 17 13:21:30 2022 +0100
Better fix for --enable-preview errors. Suggested by Alan Bateman
---
.../el/TestImportHandlerStandardPackages.java | 27 ++--------------------
1 file changed, 2 insertions(+), 25 deletions(-)
diff --git a/test/javax/el/TestImportHandlerStandardPackages.java
b/test/javax/el/TestImportHandlerStandardPackages.java
index 87ad0aa618..e624f327ea 100644
--- a/test/javax/el/TestImportHandlerStandardPackages.java
+++ b/test/javax/el/TestImportHandlerStandardPackages.java
@@ -70,12 +70,10 @@ public class TestImportHandlerStandardPackages {
.map(c -> c.substring(10, c.length() - 6)) //
Extract class name
.map(c-> {
try {
- return Class.forName("java.lang." + c); // Get
the class object
+ return Class.forName("java.lang." + c, false,
+
TesterImportHandlerPerformance.class.getClassLoader()); // Get the class
object
} catch (ClassNotFoundException e) {
throw new RuntimeException(c);
- } catch (Throwable t) {
- swallowEnablePreview(c, t);
- return null;
}
})
.filter(c -> null != c)
@@ -162,25 +160,4 @@ public class TestImportHandlerStandardPackages {
Stream<String> result = (Stream<String>)
clazzModuleReader.getMethod("list").invoke(mr);
return result;
}
-
-
- /*
- * This is a bit of a hack but there isn't a specific exception that can be
- * caught.
- */
- private void swallowEnablePreview(String className, Throwable t) {
- while (t != null) {
- if (t.getMessage() != null &&
t.getMessage().contains("--enable-preview")) {
- return;
- }
-
- Throwable cause = t.getCause();
- if (t == cause) {
- break;
- }
- t = cause;
- }
-
- throw new RuntimeException(className, t);
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]