From 3646c377efa66fbbf1c2bf414d8c99ac8541fe4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=CC=88rg=20Prante?= Date: Fri, 13 Nov 2020 14:58:16 +0100 Subject: [PATCH] fix NPE --- gradle.properties | 2 +- .../http/server/protocol/http1/HttpPipeliningHandler.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 91f4971..38dafce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group = org.xbib name = netty-http -version = 4.1.54.1 +version = 4.1.54.2 gradle.wrapper.version = 6.6.1 netty.version = 4.1.54.Final diff --git a/netty-http-server/src/main/java/org/xbib/netty/http/server/protocol/http1/HttpPipeliningHandler.java b/netty-http-server/src/main/java/org/xbib/netty/http/server/protocol/http1/HttpPipeliningHandler.java index 6f40ec2..67da599 100644 --- a/netty-http-server/src/main/java/org/xbib/netty/http/server/protocol/http1/HttpPipeliningHandler.java +++ b/netty-http-server/src/main/java/org/xbib/netty/http/server/protocol/http1/HttpPipeliningHandler.java @@ -92,9 +92,10 @@ public class HttpPipeliningHandler extends ChannelDuplexHandler { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { - logger.log(Level.SEVERE, cause.getMessage(), cause); + String message = cause.getMessage() == null ? "null" : cause.getMessage(); + logger.log(Level.SEVERE, message, cause); ctx.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.INTERNAL_SERVER_ERROR, - Unpooled.copiedBuffer(cause.getMessage().getBytes(StandardCharsets.UTF_8)))); + Unpooled.copiedBuffer(message.getBytes(StandardCharsets.UTF_8)))); } }