We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Sam Brannen opened SPR-7323 and commented
The inconsistent behavior is due to improper tracking of the lastKey for maps in Selection.getValueInternal(ExpressionState).
lastKey
Selection.getValueInternal(ExpressionState)
The following can be used to reproduce the bug:
class MapTestBean { private final Map<String, String> colors = new TreeMap<String, String>(); MapTestBean() { colors.put("red", "rot"); colors.put("brown", "braun"); colors.put("blue", "blau"); colors.put("yellow", "gelb"); colors.put("beige", "beige"); } public Map<String, String> getColors() { return colors; } }
EvaluationContext context = new StandardEvaluationContext(new MapTestBean()); ExpressionParser parser = new SpelExpressionParser(); Expression exp = parser.parseExpression("colors.$[key.startsWith('b')]"); Map<String, String> colorsMap = (Map<String, String>) exp.getValue(context); assertEquals(1, colorsMap.size()); assertEquals("brown", colorsMap.keySet().iterator().next());
The above test currently fails with:
org.junit.ComparisonFailure: expected:<[brown]> but was:<[yellow]>
Affects: 3.0.3
Referenced from: commits 8bd0633, db7531b
The text was updated successfully, but these errors were encountered:
Sam Brannen commented
Added code to reproduce bug.
Sorry, something went wrong.
SpEL 'select last' operator now works consistently with maps.
sbrannen
No branches or pull requests
Sam Brannen opened SPR-7323 and commented
The inconsistent behavior is due to improper tracking of the
lastKey
for maps inSelection.getValueInternal(ExpressionState)
.The following can be used to reproduce the bug:
The above test currently fails with:
Affects: 3.0.3
Referenced from: commits 8bd0633, db7531b
The text was updated successfully, but these errors were encountered: