8161558: ListIterator should not discard cause on exception

Reviewed-by: smarks
This commit is contained in:
Kiran Sidhartha Ravikumar 2020-03-13 18:38:07 +00:00
parent cd7d175001
commit fa069be2f2
3 changed files with 143 additions and 2 deletions

View file

@ -374,7 +374,7 @@ public abstract class AbstractList<E> extends AbstractCollection<E> implements L
return next;
} catch (IndexOutOfBoundsException e) {
checkForComodification();
throw new NoSuchElementException();
throw new NoSuchElementException(e);
}
}
@ -418,7 +418,7 @@ public abstract class AbstractList<E> extends AbstractCollection<E> implements L
return previous;
} catch (IndexOutOfBoundsException e) {
checkForComodification();
throw new NoSuchElementException();
throw new NoSuchElementException(e);
}
}