[ https://issues.apache.org/jira/browse/RATIS-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16095671#comment-16095671 ]
Jing Zhao commented on RATIS-96: -------------------------------- Thanks for fixing the issue, Nicholas! So is it possible that we can do an explicit check for "followers is empty and includeSelf is false" before calling {{computeLastCommitted}}? Then we do not need to use null/non-null Long to indicate this special case. Besides, maybe we can add a unit test for this? > LeaderState computeLastCommitted may throw ArrayIndexOutOfBoundsException > ------------------------------------------------------------------------- > > Key: RATIS-96 > URL: https://issues.apache.org/jira/browse/RATIS-96 > Project: Ratis > Issue Type: Bug > Reporter: Tsz Wo Nicholas Sze > Assignee: Tsz Wo Nicholas Sze > Attachments: r96_20170720.patch > > > {code} > java.lang.ArrayIndexOutOfBoundsException: 0 > at > org.apache.ratis.server.impl.LeaderState.computeLastCommitted(LeaderState.java:490) > at > org.apache.ratis.server.impl.LeaderState.updateLastCommitted(LeaderState.java:400) > at > org.apache.ratis.server.impl.LeaderState.handleEvent(LeaderState.java:329) > at > org.apache.ratis.server.impl.LeaderState.access$500(LeaderState.java:48) > {code} > This happens when followers is empty and not includeSelf == false. -- This message was sent by Atlassian JIRA (v6.4.14#64029)