FutureAdapter should wrap RuntimeExceptions

RuntimeExceptions thrown from FutureAdapter.adapt() should be wrapped in
an ExecutionException, not thrown as is.

Issue: SPR-12887
This commit is contained in:
Arjen Poutsma
2015-04-10 12:52:15 +02:00
parent e5b505224b
commit b119a9c82c
2 changed files with 50 additions and 9 deletions

View File

@@ -107,6 +107,12 @@ public abstract class FutureAdapter<T, S> implements Future<T> {
this.state = State.FAILURE;
throw ex;
}
catch (RuntimeException ex) {
ExecutionException execEx = new ExecutionException(ex);
this.result = execEx;
this.state = State.FAILURE;
throw execEx;
}
default:
throw new IllegalStateException();
}