[
https://issues.apache.org/jira/browse/BOOKKEEPER-940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15376703#comment-15376703
]
Enrico Olivelli edited comment on BOOKKEEPER-940 at 7/14/16 9:59 AM:
---------------------------------------------------------------------
The fix is quite simple, but I have only one doubt, in
BookKeeperAdmin:LedgerEntriesIterator
old code is
{code}
@Override
public LedgerEntry next() {
++nextEntryId;
LedgerEntry entry = currentEntry;
currentEntry = null;
return entry;
}
{code}
my proposal is
{code}
@Override
public LedgerEntry next() {
if (lastEntryId > -1 && nextEntryId > lastEntryId) {
throw new NoSuchElementException();
}
++nextEntryId;
LedgerEntry entry = currentEntry;
currentEntry = null;
return entry;
}
{code}
FindBugs complaints that a call to "next()" will never throw
NoSuchElementException.
The logic of this iterator is not very clear to me in case of lastEntryId = -1
The proposed fix adds the throw statement for a sure NoSuchElementException
case, but leaves uncovered the lastEntryId = -1 case.
was (Author: eolivelli):
The fix is quite simple, but I have only one doubt, in
BookKeeperAdmin:LedgerEntriesIterator
old code is
{code}
@Override
public LedgerEntry next() {
++nextEntryId;
LedgerEntry entry = currentEntry;
currentEntry = null;
return entry;
}
{code}
my proposal is
{code}
@Override
public LedgerEntry next() {
if (lastEntryId > -1 && nextEntryId > lastEntryId) {
throw new NoSuchElementException();
}
++nextEntryId;
LedgerEntry entry = currentEntry;
currentEntry = null;
return entry;
}
{code}
FindBugs complaints that a call to "next()" will never throw
NoSuchElementException.
The logic of this iterator is not very clear to me in case of lastEntryId = -1
> Fix findbugs warnings after bumping to java 8
> ---------------------------------------------
>
> Key: BOOKKEEPER-940
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-940
> Project: Bookkeeper
> Issue Type: Bug
> Reporter: Sijie Guo
> Assignee: Enrico Olivelli
> Priority: Blocker
> Fix For: 4.5.0
>
>
> after bumping to java 8, the ci jobs fail with findbugs warnings. we'd need
> to fix all the findbugs warnings.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)