Trying to decode % character in a parameter value JMeter fails with IllegalArgumentException: URLDecoder: Illegal hex characters in escape(%) pattern

我的梦境 提交于 2019-12-11 07:54:54

问题


Using Apache JMeter 2.7, the message body (JSON) for my POST request contains a password field which is in the form asdf%xy3dsfsfsf. JMeter is trying to interpret %xy as percent encoded character and throwing this exception.

Uncaught Exception java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape(%) pattern - For input string: "xy". See log file for details.

I cannot escape the character using backslash asdf\%xy3dsfsfsf since it would get to the webservice as the incorrect password.

Please advice on how to resolve this issue.

UPDATE: The issue is resolved in build 2578. https://builds.apache.org/job/JMeter-trunk/2578/


回答1:


You can try checking encode checkbox on the parameter in Parameters Tab as you value contains special char %.

From reference about Send Parameters With the Request:

  • http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Request

Additionally, you can specify whether each parameter should be URL encoded. If you are not sure what this means, it is probably best to select it. If your values contain characters such as & or spaces, or question marks, then encoding is usually required.

See also:

  • http://www.blooberry.com/indexdot/html/topics/urlencoding.htm#whatwhy

Finally, can you confirm you get the exception when clicking HTTP Request in View Results Tree, I've raised a bug to improve this behaviour anyway which has been fixed:

  • https://issues.apache.org/bugzilla/show_bug.cgi?id=53874

Maybe you could try the nightly build which will is now available and give some feedback, see instructions for using it here:

  • http://jmeter.apache.org/nightly.html

Regards

Philippe M.



来源:https://stackoverflow.com/questions/12428421/trying-to-decode-character-in-a-parameter-value-jmeter-fails-with-illegalargum

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!