Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2193

View: use View.getCoord() to determine coordinator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 4.0.4
    • None
    • None

    Description

      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.

              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) 
      

      Attachments

        Activity

          People

            rhn-engineering-bban Bela Ban
            rhn-engineering-bban Bela Ban
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: