日期:2014-05-18  浏览次数:20650 次

使用URLDecoder.decode 报URLDecoder: Illegal hex characters in escape (%) pattern
使用URLDecoder.decode() 方法接收参数时如果参数中含有“%”这个字符,就会抛异常 java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern -,
不知道如何解决,求高手赐教解决方法,网上搜过,由于公司限制网址,所有没有查到解决的办法

代码:

如前台传参这两个
oid=37729&sendReson=是的%试试

private HashMap<String, Object> getRequestParamByPost()
    {
        HashMap<String, Object> paraMap = new HashMap<String, Object>();
        try
        {
            String requestJson = URLDecoder.decode(
                    this.getRequestJsonObject() == null ? "" : this
                            .getRequestJsonObject(), "UTF-8")
;
            this.log.info(requestJson);
            if (requestJson != null && !requestJson.equals(""))
            {
                String[] requestJsonArr = requestJson.split("&");
                String[] tempArr = null;
                for (String str : requestJsonArr)
                {
                    tempArr = str.split("=");
                    if (tempArr != null && tempArr.length == 2)
                    {
                        paraMap.put(tempArr[0], tempArr[1]);
                    }