Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncResult calls SuccessCallback when it should call FailureCallback [SPR-14249] #18822

Closed
spring-issuemaster opened this issue May 4, 2016 · 1 comment
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented May 4, 2016

Sven Zethelius opened SPR-14249 and commented

If the AsyncResult was created with AsyncResult.forExecutionException(Throwable), then you try to add callback with AsyncResult.addCallback(ListenableFutureCallback<? super V>), onSuccess(null) is called instead of onFailure(throwable).

@Override
public void addCallback(SuccessCallback<? super V> successCallback, FailureCallback failureCallback) {
try {
// This needs to check if this.executionException != null here and call onFailure instead
successCallback.onSuccess(this.value);
}
catch (Throwable ex) {
failureCallback.onFailure(ex);
}
}


Affects: 4.2.5

Issue Links:

  • #18358 ListenableFutureAdapter.addCallback may or may not propagate failures from a FailureCallback in the calling thread
  • #17668 AsyncResult implementation does not allow for throwing ExecutionException

Referenced from: commits 1b1aac9, 5fc0d43

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 5, 2016

Juergen Hoeller commented

This is effectively fixed in 4.3 already, as a consequence of the refinements behind #18358 (which primarily deal with consistent exception handling for onSuccess callback failures).

In any case, the particular issue here seems worth fixing in 4.2.6 as well, so I'll backport the explicit exception check (while preserving the general onSuccess exception handling in 4.2.x).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.