summaryrefslogtreecommitdiff
path: root/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
diff options
context:
space:
mode:
authorJérôme de Bretagne <jerome.debretagne@gmail.com>2021-05-16 10:53:00 +0200
committerJérôme de Bretagne <jerome.debretagne@gmail.com>2021-05-20 22:40:37 +0200
commit89b49a25a1a03281c1f7452b37184dfb4621d79f (patch)
treef9cee1cdc777950254976513db8470b304dd7a06 /lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
parent570de52b6d76477ee03afa6168ad2b963878dc57 (diff)
downloaderlang-89b49a25a1a03281c1f7452b37184dfb4621d79f.tar.gz
jinterface: Fix a NullPointerException in AbstractConnection
After a call to close(), the socket is set to null which could lead to a NullPointerException in the receive_loop when handling tick messages. End the receive_loop instead in this case.
Diffstat (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java')
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
index fb7c6869b7..7ea5d52da7 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 2000-2017. All Rights Reserved.
+ * Copyright Ericsson AB 2000-2021. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -565,6 +565,11 @@ public abstract class AbstractConnection extends Thread {
// received tick? send tock!
if (len == 0) {
synchronized (this) {
+ if (socket == null) {
+ // protect from a potential thin race when the
+ // connection to the remote node is closed
+ throw new IOException("socket was closed");
+ }
OutputStream out = socket.getOutputStream();
out.write(tock);
out.flush();