原因:后台发布文章的时候,内容里面有%,导致后台URLDecoder.decode()转码的时候报错。

看了java.net.URLDecoderdecode()的源码,原来是转码错误。

贴出部分代码,意思是取%后面的两位,从16进制转成10进制,要是转码错误就会报出这个异常。

while ( ((i+2) < numChars) && (c=='%')) {
    int v = Integer.parseInt(s.substring(i+1,i+3),16);
    if (v < 0)
        throw new IllegalArgumentException("URLDecoder: Illegal hex characters in escape (%) pattern - negative value");
    bytes[pos++] = (byte) v;
    i+= 3;
    if (i < numChars)
    c = s.charAt(i);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2021-10-12
  • 2021-05-17
  • 2021-08-12
  • 2021-08-03
猜你喜欢
  • 2022-01-22
  • 2022-12-23
  • 2021-08-11
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案