JMXProxyServlet.java at revision 411724. Using MBean qry operation, if an attribute returns a String containing a newline, the character before the newline is removed by the escape method (uses idx-1 instead of idx on line 204). e.g. PermGenStatus: Perm Gen : 19.93% (26739168/134217728\n Furthermore, the end int is not checked to be > 0 in the appendHead method - so anything starting with a newline would end up being a substring(0,-1) call (line 223) - resulting in an StringIndexOutOfBoundsException("String index out of range: -1") which would then drop into "} catch (Exception e) {} // Ignore" in listBeans causing any further attributes to not be printed out. Finally, the get operation does not use the escape method in getAttribute (line 114) so will print newlines. Guess this contravenes the JMX spec 1.2 - whose changes log says "...the newline character ('\n') is forbidden everywhere. This rule is new with 1.2."
Patches would be great ;)
Created attachment 18476 [details] Patch for newline escaping Here you go! Tested with a Spring MBean exported POJO returning strings containing newlines and starting with a newline.
Patch applied. Many thanks.