Hi Group,
I installed javamelody in an application running on payara 4.1.1.164. Although I can see nearly all (not SQL - see my last post) infomations I always get the following error in my server.log:
2016-12-19 20:37:15,812 WARN [http-thread-pool(2)] javax.enterprise.web - StandardWrapperValve[default]: Servlet.service() for servlet default threw exception
java.lang.StringIndexOutOfBoundsException: String index out of range: -27
at java.lang.String.substring(String.java:1967)
at net.bull.javamelody.I18N.writeTo(I18N.java:181)
at net.bull.javamelody.I18N.writelnTo(I18N.java:198)
at net.bull.javamelody.HtmlAbstractReport.writeln(HtmlAbstractReport.java:110)
at net.bull.javamelody.HtmlJavaInformationsReport.writeServerInfoAndContextPath(HtmlJavaInformationsReport.java:222)
at net.bull.javamelody.HtmlJavaInformationsReport.writeDetails(HtmlJavaInformationsReport.java:173)
at net.bull.javamelody.HtmlJavaInformationsReport.toHtml(HtmlJavaInformationsReport.java:82)
at net.bull.javamelody.HtmlCoreReport.toHtml(HtmlCoreReport.java:215)
at net.bull.javamelody.HtmlReport.toHtml(HtmlReport.java:76)
at net.bull.javamelody.HtmlController.doHtml(HtmlController.java:100)
I looked at the source code and think that the problem starts in
HtmlJavaInformationsReport.java:
private void writeServerInfoAndContextPath(JavaInformations javaInformations) |
|
final String serverInfo = javaInformations.getServerInfo(); |
if (serverInfo != null) { |
final String columnEnd = " </td></tr>"; |
writeln("<tr><td>#Serveur#: </td><td>"); |
final String applicationServerIconName = getApplicationServerIconName(serverInfo); |
if (applicationServerIconName != null) { |
writeln("<img src='?resource=servers/" + applicationServerIconName |
|
+ "' alt='#Serveur#'/>"); |
writeln(serverInfo + columnEnd); |
writeln("<tr><td>#Contexte_webapp#: </td><td>" + javaInformations.getContextPath() |
}
plus there is no check if the searched character was found in the htmlstring -> I18N.java
static void writeTo(String html, Writer writer) throws IOException { |
int index = html.indexOf('#'); |
final ResourceBundle resourceBundle = getResourceBundle(); |
writer.write(html, begin, index - begin); |
final int nextIndex = html.indexOf('#', index + 1); |
final String key = html.substring(index + 1, nextIndex); |
writer.write(resourceBundle.getString(key)); |
index = html.indexOf('#', begin); |
writer.write(html, begin, html.length() - begin); |
best regards Thomas
|
|