You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2022/12/19 09:07:51 UTC

[tomee] 01/01: TOMEE-4014 - Re-add "tomee.keep-server-info"

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

rzo1 pushed a commit to branch TOMEE-4014-8x
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit 02cd4ca70a1a891e4825916096e75f5be3e51972
Author: Richard Zowalla <ri...@hs-heilbronn.de>
AuthorDate: Mon Dec 19 10:06:27 2022 +0100

    TOMEE-4014 - Re-add "tomee.keep-server-info"
---
 .../java/org/apache/catalina/util/ServerInfo.java  | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tomee/apache-tomee/src/patch/java/org/apache/catalina/util/ServerInfo.java b/tomee/apache-tomee/src/patch/java/org/apache/catalina/util/ServerInfo.java
index 3bfc21b404..4f7eeb3fdf 100644
--- a/tomee/apache-tomee/src/patch/java/org/apache/catalina/util/ServerInfo.java
+++ b/tomee/apache-tomee/src/patch/java/org/apache/catalina/util/ServerInfo.java
@@ -76,16 +76,18 @@ public class ServerInfo {
             number = "9.0.x";
         }
 
-        try {
-            final int slash = info.indexOf('/');
-            Class<?> versionClass = Class.forName("org.apache.openejb.util.OpenEjbVersion");
-            Object instance = versionClass.getDeclaredMethod("get").invoke(null);
-            final String tomeeVersion = (String) versionClass.getDeclaredMethod("getVersion").invoke(instance);
-
-            info = info.substring(0, slash) + " (TomEE)" + info.substring(slash) + " (" + tomeeVersion + ")";
-        } catch (Throwable t) {
-            // ignore
-            t.printStackTrace();
+        if (SystemInstance.get().getOptions().get("tomee.keep-server-info", false)) {
+            try {
+                final int slash = info.indexOf('/');
+                Class<?> versionClass = Class.forName("org.apache.openejb.util.OpenEjbVersion");
+                Object instance = versionClass.getDeclaredMethod("get").invoke(null);
+                final String tomeeVersion = (String) versionClass.getDeclaredMethod("getVersion").invoke(instance);
+
+                info = info.substring(0, slash) + " (TomEE)" + info.substring(slash) + " (" + tomeeVersion + ")";
+            } catch (Throwable t) {
+                // ignore
+                t.printStackTrace();
+            }
         }
 
         serverInfo = info;