Skip to content

CommonDelegatingErrorHandler: Missing updateClassifier() in addDelegate() #2826

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

Closed
remcobIT opened this issue Oct 6, 2023 · 0 comments · Fixed by #2829
Closed

CommonDelegatingErrorHandler: Missing updateClassifier() in addDelegate() #2826

remcobIT opened this issue Oct 6, 2023 · 0 comments · Fixed by #2829

Comments

@remcobIT
Copy link

remcobIT commented Oct 6, 2023

While creating a CommonDelegatingErrorHandler I ran (probably) into a bug. I used addDelegate() to add a different errorhandler in case of a specific exception in the cause chain (I set causeChainTraversing to true), but the default errorhandler was triggered instead.

I came to know by checking this source code that in addDelegate() the private method updateClassifier() isn't called. So I used the method setErrorHandlers() instead and now it is working.

https://github.com/spring-projects/spring-kafka/blob/638ee013e1b742c1e0af21b565f1e49af94932da/spring-kafka/src/main/java/org/springframework/kafka/listener/CommonDelegatingErrorHandler.java#L121C16-L121C16

Is this a bug in addDelegate()?

@garyrussell garyrussell added this to the 3.1.0-RC1 milestone Oct 6, 2023
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Oct 9, 2023
Resolves spring-projects#2826

The `addDelegate` method did not update the classifier, so it failed to
work when cause chain traversal is enabled.

**cherry-pick to 3.0.x, 2.9.x**
artembilan pushed a commit that referenced this issue Oct 9, 2023
Resolves #2826

The `addDelegate` method did not update the classifier, so it failed to
work when cause chain traversal is enabled.

**cherry-pick to 3.0.x, 2.9.x**

* Do not mutate the delegates field until after the validity check.
artembilan pushed a commit that referenced this issue Oct 9, 2023
Resolves #2826

The `addDelegate` method did not update the classifier, so it failed to
work when cause chain traversal is enabled.

**cherry-pick to 3.0.x, 2.9.x**

* Do not mutate the delegates field until after the validity check.
# Conflicts:
#	spring-kafka/src/main/java/org/springframework/kafka/listener/CommonDelegatingErrorHandler.java
artembilan pushed a commit that referenced this issue Oct 9, 2023
Resolves #2826

The `addDelegate` method did not update the classifier, so it failed to
work when cause chain traversal is enabled.

**cherry-pick to 3.0.x, 2.9.x**

* Do not mutate the delegates field until after the validity check.

# Conflicts:
#	spring-kafka/src/main/java/org/springframework/kafka/listener/CommonDelegatingErrorHandler.java
@garyrussell garyrussell changed the title CommonDelegatingErrorHandler: Missing updateClassifier() in addDelegate()? CommonDelegatingErrorHandler: Missing updateClassifier() in addDelegate() Oct 9, 2023
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Oct 9, 2023
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Oct 9, 2023
artembilan pushed a commit that referenced this issue Oct 9, 2023
Resolves #2832

**cherry-pick to 3.0.x, 2.9.x**
artembilan pushed a commit that referenced this issue Oct 9, 2023
Resolves #2832

**cherry-pick to 3.0.x, 2.9.x**

(cherry picked from commit 43650a4)
artembilan pushed a commit that referenced this issue Oct 9, 2023
Resolves #2832

**cherry-pick to 3.0.x, 2.9.x**

(cherry picked from commit 43650a4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants