From 45f75d5ce0dcb4e8c68ea59109211dda8799565f Mon Sep 17 00:00:00 2001 From: Aditya Borikar Date: Sat, 27 Jun 2020 02:07:42 +0530 Subject: [PATCH] Remove unrequired assignment of value to connectionEndpoint variable The current code would work just fine for a connection having multiple endpoints. However, when there is only one endpoint ConnectionAttemptState.nextAddress() would return null, since connectionEndpointIterator has already iterated over the only possible value in the contructor leading to a NullPointerException. This means that during establishment of a connection having multiple endpoints, the first value inside connectionEndpointIterator would always be overlooked. --- .../java/org/jivesoftware/smack/tcp/ConnectionAttemptState.java | 1 - 1 file changed, 1 deletion(-) diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/ConnectionAttemptState.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/ConnectionAttemptState.java index d8a3890e0..1a092edcd 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/ConnectionAttemptState.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/ConnectionAttemptState.java @@ -69,7 +69,6 @@ public final class ConnectionAttemptState { List endpoints = discoveredEndpoints.result.discoveredRemoteConnectionEndpoints; connectionEndpointIterator = endpoints.iterator(); - connectionEndpoint = connectionEndpointIterator.next(); connectionExceptions = new ArrayList<>(endpoints.size()); }