From bd71ae81b0fa5fadccdde3628717819b13b669ab Mon Sep 17 00:00:00 2001 From: James Watson Date: Wed, 19 May 2021 12:09:45 +0100 Subject: [PATCH] [Java] Fix NPE in cluster client after multiple redirects. (#1179) --- .../java/io/aeron/cluster/client/AeronCluster.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java b/aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java index 69ccaba2e1f..f10a323cb4e 100644 --- a/aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java +++ b/aeron-cluster/src/main/java/io/aeron/cluster/client/AeronCluster.java @@ -1705,19 +1705,17 @@ private void updateMembers() { ingressPublication = leader.publication; leader.publication = null; - CloseHelper.closeAll(memberByIdMap.values()); - memberByIdMap = parseIngressEndpoints(egressPoller.detail()); } - else - { - CloseHelper.closeAll(memberByIdMap.values()); - memberByIdMap = parseIngressEndpoints(egressPoller.detail()); + CloseHelper.closeAll(memberByIdMap.values()); + memberByIdMap = parseIngressEndpoints(egressPoller.detail()); + + if (ingressPublication == null) + { final MemberIngress member = memberByIdMap.get(leaderMemberId); final ChannelUri channelUri = ChannelUri.parse(ctx.ingressChannel()); channelUri.put(CommonContext.ENDPOINT_PARAM_NAME, member.endpoint); - member.publication = addIngressPublication(ctx, channelUri.toString(), ctx.ingressStreamId()); - ingressPublication = member.publication; + ingressPublication = addIngressPublication(ctx, channelUri.toString(), ctx.ingressStreamId()); } step(1);