[jboss-dev] [JMX/Web Console] Possible bug in HtmlAdaptorServlet.updateAttributes()?

Domenico Briganti dometec at gmail.com
Mon Dec 22 17:27:53 EST 2008


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(HtmlAdaptorServl
et.java:399)

        at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.updateAttributes(HtmlAdaptorSe
rvlet.java:259)

        at
org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServ
let.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&amp;name=<%=
URLEncoder.encode(request.getParameter("name"),"UTF-8") %>'"/>

---

>       <input type="button" value="Refresh MBean View"
onClick="javascript:location='HtmlAdaptor?action=inspectMBean&amp;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

Domenico Briganti

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-development/attachments/20081222/959bfbcc/attachment.html 


More information about the jboss-development mailing list