Skip Menu |

This queue is for tickets about the jmx4perl CPAN distribution.

Report information
The Basics
Id: 75322
Status: resolved
Priority: 0/
Queue: jmx4perl

People
Owner: Nobody in particular
Requestors: bigbeerjr [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.04
Fixed in: (no value)



Subject: Not correctly escaping / when executing bean methods
Hello, I recently upgraded to 1.04 (from an unknown past version) and some of the scripts that I had written started failing with: Invalid number of operation arguments. Operation <method name> on <bean> requires X parameters, not X as given. I did a packet capture and noticed that when preforming the GET to the jolokia instance, / is used to separate the arguments. In 2 cases I have /'s in my arguments. In one case I have a string with some /, if I substitute the / with &#47; everything works ok. In another case I have some xml defined as a string, substituting the / gets the the correct number of params called, but the xml fails to be correctly parsed by the bean, leading me to thing there is more escaping that is not being done correctly. I am using something like: $p1 = "07/17/1980" $jmx = new JMX::Jmx4Perl(url => $url, product => "jboss"); $value = $jmx->execute($mbean,$operation,$p1); print $value; Thanks!
Sending the previous mail has failed. Please contact your admin, they can find more details in the logs.
Sending the previous mail has failed. Please contact your admin, they can find more details in the logs.
First of all, if you want to avoid any escaping issue, I highly
recommend to use POST instead of GET for the requests.  
 
Next, the escaping scheme changed from pre-1.0 to 1.0 so that instead
of my own clumsy escaping scheme ("/" —> "/—/") it uses now usual
escaping with \ ("/" -> "\/") ehm, I mean "!" as escape parameter. See
the details.  Using HTML entity encoding doesn't work, since most
Servlet containers unescape the slashes already before the agent is
called (for security reasons mostly).
 
See the sidebar in the reference manual under the URL above.  If you
use a Jolokia agent < 1.0 and jmx4perl >= 1.0 you can use the
commandline option '--legacy-escaping' on all tools.  If you have an
Jolokia agent >= 1.0.0 and jmx4perl < 1.0 you should upgrade jmx4perl
(but this you already did).  For you code example in the bug ticket
you can add the option ("legacy-escape" => 1) to the constructor of
JMX::Jmx4Perl (and BTW can ommit "product" => "jboss" if you dont' use
any alias feature from jmx4perl), but only if you are talking with a
pre 1.0 Jolokia agent.
 
Sorry for the inconvenience, but I wanted to remove the old escaping
scheme before going 1.0. From now, I will be much more careful with
respect to backwards comatibility.
 
 
From: bigbeerjr [...] gmail.com
On Wed Feb 29 14:05:56 2012, ROLAND wrote: Show quoted text
> First of all, if you want to avoid any escaping issue, I > highlyrecommend to use > POST instead of GET for the requests. Next, the escaping scheme > changed from > pre-1.0 to 1.0 so that insteadof my own clumsy escaping scheme ("/" —> > "/—/") > it uses now usualescaping with \ ("/" -> "\/") ehm, I mean "!" as > escape > parameter. Seehttp://www.jolokia.org/reference/html/protocol.html#get- > request > forthe details. Using HTML entity encoding doesn't work, since > mostServlet > containers unescape the slashes already before the agent iscalled (for > security > reasons mostly). See the sidebar in the reference manual under the URL > above. > If youuse a Jolokia agent < 1.0 and jmx4perl >= 1.0 you can use > thecommandline > option '--legacy-escaping' on all tools. If you have anJolokia agent
> >= 1.0.0
> and jmx4perl < 1.0 you should upgrade jmx4perl(but this you already > did). For > you code example in the bug ticketyou can add the option ("legacy- > escape" => 1) > to the constructor ofJMX::Jmx4Perl (and BTW can ommit "product" => > "jboss" if > you dont' useany alias feature from jmx4perl), but only if you are > talking with > apre 1.0 Jolokia agent. Sorry for the inconvenience, but I wanted to > remove the > old escapingscheme before going 1.0. From now, I will be much more > careful withrespect > to backwards comatibility.
This is correct. I have jolokia agent 0.91 deployed. Using either the legacy-escape option or switching to post fixes the issue. THANK YOU, please close this bug.
solved.