From b28347d282474ec1bd6b978b290873d05d1bd320 Mon Sep 17 00:00:00 2001 From: Wei-Chiu Chuang Date: Tue, 18 Feb 2020 21:53:08 -0800 Subject: [PATCH] HADOOP-16868. ipc.Server readAndProcess threw NullPointerException. Contributed by Tsz-wo Sze. (cherry picked from commit cb3f3cca01d6ab9f4befb1bcd31f384c37c0231a) (cherry picked from commit d411a849e10910d24cf1bbc8d64405470e00f510) --- .../src/main/java/org/apache/hadoop/ipc/Server.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java index 4cacc593fb2..c827f997d1d 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java @@ -1789,7 +1789,7 @@ public abstract class Server { private SocketChannel channel; private ByteBuffer data; - private ByteBuffer dataLengthBuffer; + private final ByteBuffer dataLengthBuffer; private LinkedList responseQueue; // number of outstanding rpcs private AtomicInteger rpcCount = new AtomicInteger(); @@ -2833,7 +2833,6 @@ public abstract class Server { private synchronized void close() { disposeSasl(); data = null; - dataLengthBuffer = null; if (!channel.isOpen()) return; try {socket.shutdownOutput();} catch(Exception e) {