Details
Description
I tried to get the Geronimo Application Server 2.1.1 running on a SAP JVM. But the startup fails.
I found this error message in the log:
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 7
at java.lang.String.substring(String.java:1799)
at org.apache.geronimo.system.properties.JvmVendor.<clinit>(JvmVendor.java:50)
... 25 more
At this line a subString(0, 7) is performed on the VM vendor name, but the full vendor name of a SAP JVM contains only 6 characters "SAP AG".
I did a small fix which adds an additional length check:
Index: src/main/java/org/apache/geronimo/system/properties/JvmVendor.java
===================================================================
— src/main/java/org/apache/geronimo/system/properties/JvmVendor.java (Revision 677904)
+++ src/main/java/org/apache/geronimo/system/properties/JvmVendor.java (Arbeitskopie)
@@ -47,7 +47,10 @@
boolean bApache = fullVendorName.substring(0, 6).equalsIgnoreCase("Apache"); // aka. Apache Harmony
boolean bIBM = fullVendorName.substring(0, 3).equalsIgnoreCase("IBM"); // aka. IBM, but not IBM Hybrid
boolean bSun = !bIBM && !bApache; // default all others to Sun
- boolean bHP = fullVendorName.substring(0, 7).equalsIgnoreCase("Hewlett"); // aka. Hewlett-Packard Company
+// boolean bHP = fullVendorName.substring(0, 7).equalsIgnoreCase("Hewlett"); // aka. Hewlett-Packard Company
+ boolean bHP = false;
+ if (fullVendorName.length() >= 7)
+ bHP = fullVendorName.substring(0, 7).equalsIgnoreCase("Hewlett"); // aka. Hewlett-Packard Company
boolean bIBMHybrid = false;
// Special code for IBM Hybrid SDK (Sun JVM with IBM extensions on Solaris and HP-UX)
After applying this fix the app-server started fine.
Best regards,
Markus Ofterdinger