提交 90395ee6 编写于 作者: J Jesse Glick

Do not throw Error for a recoverable condition.

In this case, someone tried to add an element to a persisted list, and it was added in memory but the configuration could not be saved.
Unclear whether that should even be treated as an error condition (the write failure might be transient, and a subsequent write would store the addition),
but if it should be then we should throw a simple runtime exception.
上级 aa554ea5
......@@ -174,13 +174,13 @@ public class PersistedList<T> extends AbstractList<T> {
}
/**
* Version of {@link #_onModified()} that swallows an exception for compliance with {@link List}.
* Version of {@link #onModified()} that throws an unchecked exception for compliance with {@link List}.
*/
private void _onModified() {
try {
onModified();
} catch (IOException e) {
throw new Error(e);
throw new RuntimeException(e);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册