From bf3133c2bca5a176ddcee3656081ceed60e2c415 Mon Sep 17 00:00:00 2001 From: jansupol Date: Fri, 12 May 2023 10:32:07 +0200 Subject: [PATCH] Fix possible NPE in netty client Signed-off-by: jansupol --- .../jersey/netty/connector/JerseyClientHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java index af8fa5a158..c43cede5d6 100644 --- a/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java +++ b/connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/JerseyClientHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -188,6 +188,9 @@ public int read() throws IOException { if (content.isReadable()) { content.retain(); + if (nis == null) { + nis = new NettyInputStream(); + } nis.publish(content); }