上传图片报错java.lang.IllegalArgumentException: !hex:3b

2017-08-07 14:49:14 [com.sanqimei.www.common.log.ExceptionLogger:59]-[ERROR] 127.0.0.1|/medicalSpu/addSpu{}|20170807144914
java.lang.IllegalArgumentException: !hex:3b
at org.eclipse.jetty.util.TypeUtil.convertHexDigit(TypeUtil.java:369)
at org.eclipse.jetty.util.UrlEncoded.decodeUtf8To(UrlEncoded.java:511)
at org.eclipse.jetty.util.UrlEncoded.decodeTo(UrlEncoded.java:565)
at org.eclipse.jetty.server.Request.extractParameters(Request.java:331)
at org.eclipse.jetty.server.Request.getParameter(Request.java:741)
at com.jfinal.core.Controller.getPara(Controller.java:119)
at com.sanqimei.www.common.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:29)
at com.jfinal.aop.Invocation.invoke(Invocation.java:67)
at com.jfinal.core.ActionHandler.handle(ActionHandler.java:74)
at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)
at com.jfinal.ext.handler.ContextPathHandler.handle(ContextPathHandler.java:48)
at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:74)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:209)
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:244)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1307)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(Servl

 

解决办法:

获取参数param之后,在param后面添加:  param.replaceAll("%(?![0-9a-fA-F]{2})", "%25");

出现原因:图片在http传输过程当中会出现%,后台接收就会报错。替换之后为题解决。

 

转载于:https://www.cnblogs.com/21heshang/p/7307719.html

你可能感兴趣的:(上传图片报错java.lang.IllegalArgumentException: !hex:3b)