原因:后台發布文章的時候,內容里面有
%
,導致后台URLDecoder.decode()
轉碼的時候報錯。
看了java.net.URLDecoder
的decode()
的源碼,原來是轉碼錯誤。
貼出部分代碼,意思是取%
后面的兩位,從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);
}