Skip to content

Commit

Permalink
test: fix npe issue introduced by #20933
Browse files Browse the repository at this point in the history
zookeeper 3.9.1 add a check to print a log.
```java
                if (addr.getPort() == 0) {
                    LOG.info("bound to port {}", this.ss.getLocalAddress());
                }
```
  • Loading branch information
liangyepianzhou committed Feb 15, 2024
1 parent 7498242 commit 1559dea
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.concurrent.CountDownLatch;

Expand Down Expand Up @@ -54,6 +55,9 @@ public class ZooKeeperUtil {
private String connectString;

public ZooKeeperUtil() {
String loopbackIPAddr = InetAddress.getLoopbackAddress().getHostAddress();
zkaddr = new InetSocketAddress(loopbackIPAddr, 0);
connectString = loopbackIPAddr + ":" + zooKeeperPort;
}

public ZooKeeper getZooKeeperClient() {
Expand Down

0 comments on commit 1559dea

Please sign in to comment.