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 2022/05/17 12:21:49 UTC
[tomcat] branch main updated: Better fix for --enable-preview errors. Suggested by Alan Bateman
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 55b8f13be6 Better fix for --enable-preview errors. Suggested by Alan Bateman
55b8f13be6 is described below
commit 55b8f13be647e698032e84a7ea9c4dbf21ac5847
Author: Mark Thomas <ma...@apache.org>
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/jakarta/el/TestImportHandlerStandardPackages.java b/test/jakarta/el/TestImportHandlerStandardPackages.java
index 8d7def7005..ebd2d8610b 100644
--- a/test/jakarta/el/TestImportHandlerStandardPackages.java
+++ b/test/jakarta/el/TestImportHandlerStandardPackages.java
@@ -62,12 +62,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)
@@ -133,25 +131,4 @@ public class TestImportHandlerStandardPackages {
}
}
}
-
-
- /*
- * 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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org