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

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

commit 84d78cce19c57f291949ad3c2e8b2a0649ef497c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed May 18 17:08:08 2022 +0100

    Improve error message if a required --add-opens option is missing
---
 java/org/apache/tomcat/util/compat/Jre9Compat.java | 6 +++++-
 webapps/docs/changelog.xml                         | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/compat/Jre9Compat.java 
b/java/org/apache/tomcat/util/compat/Jre9Compat.java
index 87a3c385c0..86fba5eb30 100644
--- a/java/org/apache/tomcat/util/compat/Jre9Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre9Compat.java
@@ -253,7 +253,11 @@ class Jre9Compat extends JreCompat {
     public String getModuleName(Class<?> type) {
         try {
             Object module = getModuleMethod.invoke(type);
-            return (String) getNameMethod.invoke(module);
+            String moduleName = (String) getNameMethod.invoke(module);
+            if (moduleName == null) {
+                moduleName = "ALL-UNNAMED";
+            }
+            return moduleName;
         } catch (ReflectiveOperationException e) {
             return "ERROR";
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c19ee8e19b..5a519acaa2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -111,6 +111,10 @@
         Update the memory leak protection code to support stopping application
         created executor threads when running on Java 19 and later. (markt)
       </fix>
+      <fix>
+        Improve the error message if a required <code>--add-opens</code> option
+        is missing. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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

Reply via email to