码迷,mamicode.com
首页 > 编程语言 > 详细

解决kindeidtor与struts2框架交互WARN OgnlValueStack:68 - Error setting value [[Ljava.lang.String;@10da4df]的bug

时间:2017-08-06 12:50:13      阅读:590      评论:0      收藏:0      [点我收藏+]

标签:asi   exp   http   core   dia   upload   ctc   epo   .ajax   

当用使用ssh框架,前端用到kindeitor富文本编辑器时候,上传文件后有一个图片管理.当点击图片管理的时候,在后台会报一个异常:

WARN OgnlValueStack:68 - Error setting value [[Ljava.lang.String;@10da4df] with expression [1501984936145]
java.lang.NumberFormatException: For input string: "1501984936145"1501985270344
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:495)
    at java.lang.Integer.valueOf(Integer.java:556)
    at ognl.OgnlParserTokenManager.makeInt(OgnlParserTokenManager.java:63)
    at ognl.OgnlParserTokenManager.TokenLexicalActions(OgnlParserTokenManager.java:1624)
    at ognl.OgnlParserTokenManager.getNextToken(OgnlParserTokenManager.java:1498)
    at ognl.OgnlParser.jj_ntk(OgnlParser.java:3099)
    at ognl.OgnlParser.unaryExpression(OgnlParser.java:1079)
    at ognl.OgnlParser.multiplicativeExpression(OgnlParser.java:971)
    at ognl.OgnlParser.additiveExpression(OgnlParser.java:894)
    at ognl.OgnlParser.shiftExpression(OgnlParser.java:750)
    at ognl.OgnlParser.relationalExpression(OgnlParser.java:508)
    at ognl.OgnlParser.equalityExpression(OgnlParser.java:405)
    at ognl.OgnlParser.andExpression(OgnlParser.java:352)
    at ognl.OgnlParser.exclusiveOrExpression(OgnlParser.java:299)
    at ognl.OgnlParser.inclusiveOrExpression(OgnlParser.java:246)
    at ognl.OgnlParser.logicalAndExpression(OgnlParser.java:193)
    at ognl.OgnlParser.logicalOrExpression(OgnlParser.java:140)
    at ognl.OgnlParser.conditionalTestExpression(OgnlParser.java:101)
    at ognl.OgnlParser.assignmentExpression(OgnlParser.java:64)
    at ognl.OgnlParser.expression(OgnlParser.java:23)
    at ognl.OgnlParser.topLevelExpression(OgnlParser.java:15)
    at ognl.Ognl.parseExpression(Ognl.java:110)
    at com.opensymphony.xwork2.ognl.OgnlUtil.compileAndExecute(OgnlUtil.java:332)
    at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:282)
    at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:186)
    at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:173)
    at com.opensymphony.xwork2.ognl.OgnlValueStack.setParameter(OgnlValueStack.java:151)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:303)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:221)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.DateTextFieldInterceptor.intercept(DateTextFieldInterceptor.java:125)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

这个异常是由于kindeditor为了避免浏览器缓存,于是在后台链接里面加上了当前时间,作为一个参数传递.

而struts2框架对于这个传递过来的string类型的数据(其实应该是long类型的),解析成了integer类型的数据了,所以就会报解析异常.因为long类型的数当长度大于int类型的话,就会报一个转换异常.而struts2就会报一个解析异常.

解决办法:

在防止string类型数据被解析,修改一下传递的数据url.

在kindeditor源文件里面,找到filemanager.js文件,修改其中的第75行代码,

function reloadPage(path, order, func) {
            var param = ‘path=‘ + path + ‘&order=‘ + order + ‘&dir=‘ + dirName;
            dialog.showLoading(self.lang(‘ajaxLoading‘));
            K.ajax(K.addParam(fileManagerJson, param + ‘&‘ + new Date().getTime()), function(data) {
                dialog.hideLoading();
                func(data);
            });
        }

把原先的fileManagerJson, param + ‘&‘ + new Date().getTime()这个代码中‘&‘字符后面加一个‘=‘等号即可

示例代码

function reloadPage(path, order, func) {
            var param = ‘path=‘ + path + ‘&order=‘ + order + ‘&dir=‘ + dirName;
            dialog.showLoading(self.lang(‘ajaxLoading‘));
            K.ajax(K.addParam(fileManagerJson, param + ‘&=‘ + new Date().getTime()), function(data) {
                dialog.hideLoading();
                func(data);
            });
        }

fileManagerJson, param + ‘&=‘ + new Date().getTime().

有效避免struts去解析字符串

 

亲测有效

解决kindeidtor与struts2框架交互WARN OgnlValueStack:68 - Error setting value [[Ljava.lang.String;@10da4df]的bug

标签:asi   exp   http   core   dia   upload   ctc   epo   .ajax   

原文地址:http://www.cnblogs.com/wangxinblog/p/7294162.html

(0)
(2)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!