NutzCN Logo
问答 文件上传中,我强行关闭浏览器,AdaptorErrorContext中的errors全部为空
发布于 2256天前 作者 qq_df3d9a5c 1156 次浏览 复制 上一个帖子 下一个帖子
标签:
@AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" })
	@At("/applysource/upload")
	@Ok("json")
	@RequiresPermissions("bu:applys")
	public Object upload(@Param("files") TempFile files,
			@Param("filename") String filename,
			@Param("batchno") final String batchno,
			@Param("videoname") final String videoname,
			Long videoId,
			@Param("type") final String type, HttpServletResponse response,
			HttpServletRequest request, AdaptorErrorContext error) {
		if (!Lang.isEmpty(error)) {
			Uploads.getInfo(request);
			return Message.error(error.getAdaptorErr().toString(), request);
		}
		try {
			videoService.saveVideoinfo(files, filename, batchno, videoname, videoId, type);
			return Message.success(DbConsts.SYS_SUS, request);
			}catch (Exception e) {
			return Message.error(e.getMessage(), request);
		}

	}
10 回复

error.getAdaptorErr 应该不是null的

如果能截图就好了,我debug的时候都是null
就是error数组都是null,入参也都是null

贴一下日志看看

2018-10-19 15:07:07,914 [http-bio-8080-exec-21] INFO org.nutz.mvc.adaptor.AbstractAdaptor - Adapter Error catched , but I found AdaptorErrorContext param, so, set it to args, and continue
java.lang.RuntimeException: org.nutz.mvc.upload.UploadInvalidFormatException: Should not end stream
at org.nutz.lang.Lang.wrapThrow(Lang.java:149)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:206)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:65)
at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:225)
at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:120)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:28)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.jiedu.easyclass.common.mvc.processor.NutShiroProcessor.process(NutShiroProcessor.java:54)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.jiedu.easyclass.common.mvc.processor.XSSProcessor.process(XSSProcessor.java:41)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.jiedu.easyclass.common.mvc.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at com.jiedu.easyclass.common.mvc.processor.LogTimeProcessor.process(LogTimeProcessor.java:22)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
at com.jiedu.easyclass.common.mvc.SyncNutFilter.doFilter(SyncNutFilter.java:38)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.jiedu.easyclass.common.mvc.filter.XssFilter.doFilter(XssFilter.java:24)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1139)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: org.nutz.mvc.upload.UploadInvalidFormatException: Should not end stream
at org.nutz.mvc.upload.FastUploading.assertStreamNotEnd(FastUploading.java:241)
at org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:169)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:189)
... 59 more

------WebKitFormBoundary0KFQLaoK6QYBfxWg
2018-10-19 15:07:07,475 [http-bio-8080-exec-21] DEBUG org.nutz.mvc.upload.FastUploading - skip first boundary
2018-10-19 15:07:07,475 [http-bio-8080-exec-21] DEBUG org.nutz.mvc.upload.FastUploading - Reading...
2018-10-19 15:07:07,475 [http-bio-8080-exec-21] DEBUG org.nutz.mvc.upload.FastUploading - Upload File info: FilePath=[1.3gp],fieldName=[files]
2018-10-19 15:07:07,476 [http-bio-8080-exec-21] DEBUG org.nutz.mvc.upload.FastUploading - Upload Info: name=1.3gp,content_type=video/3gpp
2018-10-19 15:07:07,480 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [POST] path=/b/bu/resource/applysource/upload : ResourceMgrAction.upload(ResourceMgrAction.java:228)
2018-10-19 15:07:07,482 [http-bio-8080-exec-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'resourceMgrAction'<class com.jiedu.easyclass.modules.action.backend.bu.ResourceMgrAction>
2018-10-19 15:07:07,483 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.UploadAdaptor - Select Html4 Form upload parser --> /zypt/b/bu/resource/applysource/upload
2018-10-19 15:07:07,483 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - FastUpload : /b/bu/resource/applysource/upload
2018-10-19 15:07:07,483 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - info created
2018-10-19 15:07:07,483 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Params map created - 0 params
2018-10-19 15:07:07,484 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - boundary:
------WebKitFormBoundary0y5Ay2nwKy4KAndq
2018-10-19 15:07:07,579 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - skip first boundary
2018-10-19 15:07:07,579 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Reading...
2018-10-19 15:07:07,579 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Upload File info: FilePath=[1.png],fieldName=[files]
2018-10-19 15:07:07,579 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Upload Info: name=1.png,content_type=image/png
2018-10-19 15:07:07,609 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Upload File info: FilePath=[null],fieldName=[file_id]
2018-10-19 15:07:07,609 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Found a param, name=[file_id] value=[0]
2018-10-19 15:07:07,609 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Upload File info: FilePath=[null],fieldName=[filename]
2018-10-19 15:07:07,609 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Found a param, name=[filename] value=[1.png]
2018-10-19 15:07:07,609 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Upload File info: FilePath=[null],fieldName=[videoname]
2018-10-19 15:07:07,609 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Found a param, name=[videoname] value=[qq]
2018-10-19 15:07:07,610 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Upload File info: FilePath=[null],fieldName=[batchno]
2018-10-19 15:07:07,610 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Found a param, name=[batchno] value=[2018-10-19-1170]
2018-10-19 15:07:07,610 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Upload File info: FilePath=[null],fieldName=[type]
2018-10-19 15:07:07,610 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - Found a param, name=[type] value=[image]
2018-10-19 15:07:07,610 [http-bio-8080-exec-17] DEBUG org.nutz.mvc.upload.FastUploading - ...Done 207093 bytes readed

按AbstractAdaptor里面的逻辑, 有那句日志账号, 应该就会设置AdaptorError, 不太可能出现你说的情况

                if (log.isInfoEnabled())
                    log.info("Adapter Error catched , but I found AdaptorErrorContext param, so, set it to args, and continue", e);
                errCtx.setAdaptorError(e, this);

假如前端突然关闭文件上传,后端能看到文件信息就好了

关键是log能打印文件信息,但error都是null

那是已经上传完了吧

添加回复
请先登陆
回到顶部