Hi all, I downloaded JBoss 5.0.0.GA and, without any
changes, I tried to modify one MBean from jmx-console but I received 500 Internal
Server Error:
javax.management.MalformedObjectNameException: Key
properties cannot be empty
at
javax.management.ObjectName.construct(ObjectName.java:467)
at
javax.management.ObjectName.<init>(ObjectName.java:1403)
at
org.jboss.jmx.adaptor.control.Server.setAttributes(Server.java:171)
at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet$5.run(HtmlAdaptorServlet.java:403)
at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet$5.run(HtmlAdaptorServlet.java:401)
at
java.security.AccessController.doPrivileged(Native Method)
at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.setAttributes(HtmlAdaptorServlet.java:399)
at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.updateAttributes(HtmlAdaptorServlet.java:259)
at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:102)
at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doPost(HtmlAdaptorServlet.java:86)
………
After debug, I think the problem is on HtmlAdaptorServlet.updateAttributes()
that tries to set MBean value without decode the string getted from
request.getParameter().
I modified the HtmlAdaptorServlet and inspectMBean.jsp
in order to decode parameter before update, and it’s work!
That’s the diff:
______________________________________________________________________________________
In inspectMBean.jsp
143c143
< <input
type="button" value="Refresh MBean View"
onClick="javascript:location='HtmlAdaptor?action=inspectMBean&name=<%=
URLEncoder.encode(request.getParameter("name"),"UTF-8")
%>'"/>
---
> <input
type="button" value="Refresh MBean View"
onClick="javascript:location='HtmlAdaptor?action=inspectMBean&name=<%=
request.getParameter("name").indexOf("%") == -1 ?
URLEncoder.encode(request.getParameter("name"),"UTF-8") :
request.getParameter("name") %>'"/>
______________________________________________________________________________________
In HtmlAdaptorServlet.java
254c254
<
attributes.put(param, value);
---
>
attributes.put(param, URLDecoder.decode(value, "UTF-8"));
259,260c259,260
<
AttributeList newAttributes = setAttributes(name, attributes);
<
MBeanData data = getMBeanData(name);
---
>
AttributeList newAttributes = setAttributes(URLDecoder.decode(name,
"UTF-8"), attributes);
>
MBeanData data = getMBeanData(URLDecoder.decode(name, "UTF-8"));
______________________________________________________________________________________
Regards