-
Bug
-
Resolution: Fixed
-
P4
-
17, 18, 19
-
b07
Thread.dispatchUncaughtException calls getUncaughtExceptionHandler() which reads volatile field twice:
private volatile UncaughtExceptionHandler uncaughtExceptionHandler;
public UncaughtExceptionHandler getUncaughtExceptionHandler() {
return uncaughtExceptionHandler != null ?
uncaughtExceptionHandler : group;
}
private void dispatchUncaughtException(Throwable e) {
getUncaughtExceptionHandler().uncaughtException(this, e);
}
Another thread could change uncaughtExceptionHandler between 2 volatile reads. It will result in NullPointerException
private volatile UncaughtExceptionHandler uncaughtExceptionHandler;
public UncaughtExceptionHandler getUncaughtExceptionHandler() {
return uncaughtExceptionHandler != null ?
uncaughtExceptionHandler : group;
}
private void dispatchUncaughtException(Throwable e) {
getUncaughtExceptionHandler().uncaughtException(this, e);
}
Another thread could change uncaughtExceptionHandler between 2 volatile reads. It will result in NullPointerException