mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8161558: ListIterator should not discard cause on exception
Reviewed-by: smarks
This commit is contained in:
parent
cd7d175001
commit
fa069be2f2
3 changed files with 143 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,33 @@ public class NoSuchElementException extends RuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@code NoSuchElementException} with the specified detail
|
||||
* message and cause.
|
||||
*
|
||||
* @param s the detail message, or null
|
||||
* @param cause the cause (which is saved for later retrieval by the
|
||||
* {@link #getCause()} method), or null
|
||||
* @since 15
|
||||
*/
|
||||
public NoSuchElementException(String s, Throwable cause) {
|
||||
super(s, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@code NoSuchElementException} with the specified cause.
|
||||
* The detail message is set to {@code (cause == null ? null :
|
||||
* cause.toString())} (which typically contains the class and
|
||||
* detail message of {@code cause}).
|
||||
*
|
||||
* @param cause the cause (which is saved for later retrieval by the
|
||||
* {@link #getCause()} method)
|
||||
* @since 15
|
||||
*/
|
||||
public NoSuchElementException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@code NoSuchElementException}, saving a reference
|
||||
* to the error message string {@code s} for later retrieval by the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue