[jboss-jira] [JBoss JIRA] (JGRP-2193) View: use View.getCoord() to determine coordinator

Bela Ban (JIRA) issues at jboss.org
Wed Jun 7 02:29:00 EDT 2017


Bela Ban created JGRP-2193:
------------------------------

             Summary: View: use View.getCoord() to determine coordinator
                 Key: JGRP-2193
                 URL: https://issues.jboss.org/browse/JGRP-2193
             Project: JGroups
          Issue Type: Bug
            Reporter: Bela Ban
            Assignee: Bela Ban
            Priority: Minor
             Fix For: 4.0.4


Often the coord is determined by getting a view's members and grabbing the first member of the view. If the list is empty, this fails with an NPE.

Instead, use {{View.getCoord()}} and handle the potential null value.

{noformat}
        ViewId vid = new ViewId(new JGAddress(), 0);
        List<Address> members = new ArrayList<>();
        View jgv = new View(vid, members);
        this.myChannel.down(new Event(Event.VIEW_CHANGE, jgv));

java.lang.ArrayIndexOutOfBoundsException: 0
at java.util.Arrays$ArrayList.get(Arrays.java:3841)
at java.util.Collections$UnmodifiableList.get(Collections.java:1309)
at org.jgroups.protocols.pbcast.STABLE.handleViewChange(STABLE.java:365)
at org.jgroups.protocols.pbcast.STABLE.down(STABLE.java:328)
at org.jgroups.protocols.FlowControl.down(FlowControl.java:347)
at org.jgroups.protocols.FlowControl.down(FlowControl.java:347)
at org.jgroups.protocols.FRAG2.down(FRAG2.java:136)
at org.jgroups.stack.ProtocolStack.down(ProtocolStack.java:1039)
at org.jgroups.JChannel.down(JChannel.java:790)
at org.apache.geode.distributed.internal.membership.gms.messenger.JGroupsMessenger.start(JGroupsMessenger.java:310) 
{noformat}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list