netty-codec-http:4.1.30解析application/json數據仍按鍵值對的方式解析,致使在windows系統下由於文件名錯誤而使程序奔潰,堆棧以下,html
2019/02/13 12:33:53 ERROR [ worker@thread-1 ] c.b.m.h.DefaultExceptionHandler : io.netty.handler.codec.http.multipart.HttpPostRequestDecoder$ErrorDataDecoderException: java.io.IOException: Unable to create temporary file, C:\Users\GDY\AppData\Local\Temp\Attr_8394434811706373163_{"cid":5,"title":...java
2019/02/13 12:33:53 INFO [ worker@thread-1 ] j.t.JetTemplateImpl : Loading template: /comm/error_500.htmljson
at io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBodyAttributes(HttpPostStandardRequestDecoder.java:609)
at io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBody(HttpPostStandardRequestDecoder.java:361)
at io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.offer(HttpPostStandardRequestDecoder.java:290)
at io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.offer(HttpPostStandardRequestDecoder.java:47)
at io.netty.handler.codec.http.multipart.HttpPostRequestDecoder.offer(HttpPostRequestDecoder.java:227)
at com.blade.mvc.http.HttpRequest.init(HttpRequest.java:359)
at com.blade.server.netty.HttpServerHandler.buildWebContext(HttpServerHandler.java:95)
at com.blade.server.netty.HttpServerHandler.lambda$channelRead0$0(HttpServerHandler.java:84)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at java.lang.Thread.run(Thread.java:745)
複製代碼
Caused by: java.io.IOException: Unable to create temporary file, C:\Users\GDY\AppData\Local\Temp\Attr_8394434811706373163_{"cid":5,"title":"...windows
at java.io.File$TempDirectory.generateFile(File.java:1921)
at java.io.File.createTempFile(File.java:2010)
at java.io.File.createTempFile(File.java:2070)
at io.netty.handler.codec.http.multipart.AbstractDiskHttpData.tempFile(AbstractDiskHttpData.java:90)
at io.netty.handler.codec.http.multipart.AbstractDiskHttpData.addContent(AbstractDiskHttpData.java:163)
at io.netty.handler.codec.http.multipart.DiskAttribute.addContent(DiskAttribute.java:99)
at io.netty.handler.codec.http.multipart.HttpPostStandardRequestDecoder.parseBodyAttributes(HttpPostStandardRequestDecoder.java:597)
... 15 more
複製代碼
修復以下:mvc
修改類文件:HttpPostStandardRequestDecoder.javaapp
if(!this.request.headers().get("Content-Type").startsWith(APPLICATION_X_WWW_FORM_URLENCODED)){ return; }oop