google-code-export / nutz

Automatically exported from code.google.com/p/nutz
Apache License 2.0
1 stars 1 forks source link

上传文件出错 #219

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题产生的条件:
extjs文件上传

发生问题的调用代码:
{
   xtype : 'textfield',
   fieldLabel : '工作流定义',
   id : 'workflowFile',
   width : 620,
   allowBlank : false,
   inputType : 'file'
}
...
form.form.submit({
    waitMsg : '保存中,请稍后...',
    method:'POST',
    url : Ext.WEB_ROOT + 'workflow/upload.nut',
    success : function(form, action) {
       Ext.MessageBox.alert('信息', '上传成功');
    },
    failure : function(form, action) {
       Ext.MessageBox.alert('信息', action.result.message);
    }
});
...
    @At("/upload")
    @AdaptBy(type = UploadAdaptor.class, args = {"~/tmp"})
    public ExtReturn uploadWorkflow(HttpServletRequest req,
HttpServletResponse res,@Param("workflowFile") File workflowFile) {...里面
就不贴了,因为已经报错了...}

问题的详细说明:
上传同样类型的文件共8个,7个正常,其中一个一直出错,反
复测试,状况一致。出
错文件随附件。

异常堆栈:
14177851 INFO  - /workflow/upload 
14177859 WARN  - org.nutz.mvc.upload.UploadInvalidFormatException: Should
not end stream 
java.lang.RuntimeException:
org.nutz.mvc.upload.UploadInvalidFormatException: Should not end stream
    at org.nutz.lang.Lang.wrapThrow(Lang.java:116)
    at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:98)
    at org.nutz.mvc.invoker.ActionInvokerImpl.invoke(ActionInvokerImpl.java:218)
    at org.nutz.mvc.ActionInvoking.invoke(ActionInvoking.java:34)
    at org.nutz.mvc.NutServlet.service(NutServlet.java:153)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilt
erChain.java:290)
    at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.
java:206)
    at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:2
33)
    at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:1
75)
    at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109
)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Pr
otocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
Caused by: org.nutz.mvc.upload.UploadInvalidFormatException: Should not end
stream
    at
org.nutz.mvc.upload.FastUploading.assertStreamNotEnd(FastUploading.java:192)
    at org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:148)
    at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:95)
    ... 16 more

相关日志:

Original issue reported on code.google.com by winst...@gmail.com on 4 Jun 2010 at 6:35

Attachments:

GoogleCodeExporter commented 9 years ago
忘了说了,nutz-1.27  jdk6 tomcat6.0.14

Original comment by winst...@gmail.com on 4 Jun 2010 at 6:36

GoogleCodeExporter commented 9 years ago
不如先试试 1.a.28 可否运行?

Original comment by wendal1985@gmail.com on 4 Jun 2010 at 6:43

GoogleCodeExporter commented 9 years ago
换成1.a.28之后,上传该文件,后台不再报异常,但是该异常��
�接写入了输出流。extjs接收到了
该异常。附件是截图

Original comment by winst...@gmail.com on 4 Jun 2010 at 6:55

Attachments:

GoogleCodeExporter commented 9 years ago
难道这么巧与nutz定义的某些东西冲突了...

这个文件是否有BOM头呢?

Original comment by wendal1985@gmail.com on 4 Jun 2010 at 7:07

GoogleCodeExporter commented 9 years ago
不清楚是否有BOM,只是奇怪的是这一批同一类的文件,只有��
�个文件出错

Original comment by winst...@gmail.com on 4 Jun 2010 at 7:14

GoogleCodeExporter commented 9 years ago
这是一个愚蠢的错误。其实我稍微有点担心这个判断

原因是文件以 \r\n 结尾

Original comment by zozoh...@gmail.com on 4 Jun 2010 at 9:04

GoogleCodeExporter commented 9 years ago
我尽快把这个 BUG 修好

Original comment by zozoh...@gmail.com on 4 Jun 2010 at 9:04

GoogleCodeExporter commented 9 years ago
赞美上帝,赞美committer

Original comment by winst...@gmail.com on 4 Jun 2010 at 9:06

GoogleCodeExporter commented 9 years ago

Original comment by wendal1985@gmail.com on 4 Jun 2010 at 9:17

GoogleCodeExporter commented 9 years ago
fixed in r1298

JUnit:

   > UploadingUnitTest.test_upload_text_with_newline_ending
   > BufferRingTest :
                   test_mark_dangerous_char
                   test_mark_dangerous_char2
                   test_mark_dangerous_char3
   > RemountBytesTest :
                   test_case_A
                   test_case_A2
                   test_case_B
                   test_case_C
                   test_case_D

Original comment by zozoh...@gmail.com on 5 Jun 2010 at 5:04