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

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

commit 4be7247e582ef3c3eccba10ad8ecda6a25a24b83
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 1dba8c7116..581191d954 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 Jre8Compat {
     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 53a28c5d23..91d7bc229b 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