Repository navigation
Check hasNext when when accessing sessionIds from UserDestinationResult - #34333
brandenclark wants to merge 2 commits into
Conversation
Signed-off-by: Branden Clark <[email protected]>
Signed-off-by: Branden Clark <[email protected]>
rstoyanchev
left a comment
There was a problem hiding this comment.
The proposed updates make sense. Thanks for the pull request.
As UserDestinationResult is typically created by the framework, and we no longer use the pre-6.1 constructor, we should probably deprecate it. Could you clarify what or who is calling that constructor?
|
We have a custom I'm pretty novice in this space, but it seems like the pre-6.1 constructor is still useful when needing to customize the |
See gh-34333 Signed-off-by: Branden Clark <[email protected]>
|
Thanks for the feedback. I've left both constructors. |
Closes gh-34333 Signed-off-by: Branden Clark <[email protected]>
Found a bug in
UserDestinationMessageHandler.SendHelper#sendthat occurs when theUserDestinationResultwas created by the pre-6.1.x constructor. Bug was introduced with 3277b0dIdeally this fix will target 6.1+ and should be compatible. Not sure if there's a special way to call that out as a first-time contributor.
Changes
Bug Details
The
UserDestinationMessageHandlerunsafely retrieves values from an iterator ofsessionIdstrings to lookup ordered messages.This happens when the
UserDestinationResultused to route the message was created with the pre-6.1.x constructor this retrieval throws aNoSuchElementException.This is because the older constructor passes a
nullto the newer constructor for thesessionIdsconstructor arg. The class attempts to safe handle thisnullarg by creating an EmptySet that eventually provides an [EmptyIterator],(https://github.com/openjdk/jdk/blob/98a93e115137a305aed6b7dbf1d4a7d5906fe77c/src/java.base/share/classes/java/util/Collections.java#L4559) which then throws forSet#next.This bug seems to only happen for custom implementations of
UserDestinationResolveras theDefaultUserDestinationResolveralways provides a populated set to the new constructor.