WW-5700 Skip the store when a map or list element cannot be converted (6.x backport) - #1878
Open
lukaszlenart wants to merge 1 commit into
Open
WW-5700 Skip the store when a map or list element cannot be converted (6.x backport)#1878lukaszlenart wants to merge 1 commit into
lukaszlenart wants to merge 1 commit into
Conversation
…e converted Backport of the 7.4.0 fix (#1873) to the 6.x line. When XWorkConverter cannot convert a value it returns the marker string NO_CONVERSION_POSSIBLE. The map and list property accessors stored that marker straight into the target collection, so a Map<Long, Integer> could end up holding the String "ognl.NoConversionPossible" under a String key, and the next read of that collection failed with a ClassCastException far from the cause. Skip the assignment instead and log at debug. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Backport of #1873 to the 6.x line.
When
XWorkConvertercannot convert a value it returns the marker stringNO_CONVERSION_POSSIBLE(
"ognl.NoConversionPossible").XWorkMapPropertyAccessorandXWorkListPropertyAccessorstored thatmarker straight into the target collection, so a
Map<Long, Integer>could be left holding the markerString— under aStringkey, when the key was the unconvertible half — and the next read of thatcollection failed with a
ClassCastExceptionfar from the cause. The accessors now skip the assignmentand log at debug instead.
Verified affected on 6.x before fixing: all four tests below fail on
support/struts-6-x-xwithognl.NoConversionPossiblefound in the typed collection, and pass with the fix.XWorkMapPropertyAccessorTest— value half and key halfXWorkListPropertyAccessorTest— indexed elementParametersInterceptorTest— end to end through parameter binding, using the real-world trigger(an unchecked
s:checkboxwithsubmitUnchecked="true"submits"false"into aMap<Long, Integer>)XWorkCollectionPropertyAccessoris deliberately left alone, as onmain: its scalarsetPropertyisnot reachable through the value stack, so no failing test can be written for it.
Full
coresuite green: 2721 tests, 0 failures.Fixes WW-5700
🤖 Generated with Claude Code