Skip to content

Commit 1516ab4

Browse files
authored
JAVA-1202: Handle null rpc_address when checking schema agreement. (apache#684)
1 parent 4171fc1 commit 1516ab4

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [bug] JAVA-1187: Fix warning message when local CL used with RoundRobinPolicy.
1212
- [improvement] JAVA-1175: Warn if DCAwarePolicy configuration is inconsistent.
1313
- [bug] JAVA-1139: ConnectionException.getMessage() throws NPE if address is null.
14+
- [bug] JAVA-1202: Handle null rpc_address when checking schema agreement.
1415

1516

1617
### 3.0.2

driver-core/src/main/java/com/datastax/driver/core/ControlConnection.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,13 @@ private static InetSocketAddress rpcAddressForPeerHost(Row peersRow, InetSocketA
383383

384384
if (broadcastAddress == null) {
385385
return null;
386-
} else if (broadcastAddress.equals(connectedHost.getAddress()) || rpcAddress.equals(connectedHost.getAddress())) {
386+
} else if (broadcastAddress.equals(connectedHost.getAddress()) || (rpcAddress != null && rpcAddress.equals(connectedHost.getAddress()))) {
387387
// Some DSE versions were inserting a line for the local node in peers (with mostly null values). This has been fixed, but if we
388388
// detect that's the case, ignore it as it's not really a big deal.
389389
logger.debug("System.peers on node {} has a line for itself. This is not normal but is a known problem of some DSE version. Ignoring the entry.", connectedHost);
390390
return null;
391+
} else if (rpcAddress == null) {
392+
return null;
391393
} else if (rpcAddress.equals(bindAllAddress)) {
392394
logger.warn("Found host with 0.0.0.0 as rpc_address, using broadcast_address ({}) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.", broadcastAddress);
393395
rpcAddress = broadcastAddress;

0 commit comments

Comments
 (0)