尝试解码参数值JMeter中的%字符失败,并出现IllegalArgumentException:URLDecoder:转义(%)模式中的非法十六进制字符 [英] Trying to decode % character in a parameter value JMeter fails with IllegalArgumentException: URLDecoder: Illegal hex characters in escape(%) pattern

查看:1916
本文介绍了尝试解码参数值JMeter中的%字符失败,并出现IllegalArgumentException:URLDecoder:转义(%)模式中的非法十六进制字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Apache JMeter 2.7,我的POST请求的消息正文(JSON)包含一个密码字段,其格式为asdf%xy3dsfsfsf. JMeter试图将%xy解释为百分比编码的字符,并抛出此异常.

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.

未捕获的异常java.lang.IllegalArgumentException:URLDecoder: 转义(%)模式中的非法十六进制字符-对于输入字符串:"xy". 有关详细信息,请参见日志文件.

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

我不能使用反斜杠asdf\%xy3dsfsfsf来转义该字符,因为它会以不正确的密码进入Web服务.

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.

更新: 此问题已在内部版本2578中解决. https://builds.apache.org/job/JMeter-trunk/2578/

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

推荐答案

当您的值包含特殊字符时,可以尝试在参数"标签中的参数上检查编码"复选框.

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

从有关随请求发送参数的参考中:

此外,您可以指定每个参数是否应进行URL编码.如果您不确定这意味着什么,最好选择它.如果您的值包含&等字符.或空格或问号,则通常需要编码.

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.

另请参阅:

最后,您可以确认在查看结果树"中单击"HTTP请求"时是否得到了异常.无论如何,我已经提出了一个错误来改善此行为:

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:

也许您可以尝试每晚构建的版本,该版本现已发布并提供一些反馈,请在此处查看使用说明:

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

致谢

Philippe M.

Philippe M.

这篇关于尝试解码参数值JMeter中的%字符失败,并出现IllegalArgumentException:URLDecoder:转义(%)模式中的非法十六进制字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆