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

LinkedMultiValueMap.getFirst - check that values is not empty #22421

Conversation

olszewskimichal
Copy link
Contributor

To avoid situation when values is Empty and we trying get first element without checking that this element exists

@pivotal-issuemaster
Copy link

@olszewskimichal Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@olszewskimichal Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Feb 16, 2019
@jhoeller jhoeller self-assigned this Feb 19, 2019
@neoumenon

This comment has been minimized.

@snicoll

This comment has been minimized.

@neoumenon

This comment has been minimized.

@jhoeller jhoeller changed the title getFirst - check that values is not empty LinkedMultiValueMap.getFirst - check that values is not empty May 7, 2019
@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 7, 2019
@jhoeller jhoeller added this to the 5.1.7 milestone May 7, 2019
@jhoeller
Copy link
Contributor

jhoeller commented May 7, 2019

This is indeed worth revisiting since a LinkedMultiValueMap may get constructed or populated with user-provided List instances which may be empty, even if for regular operations its internal Lists will always have an entry. Simply treating such an empty List the same as no Map entry at all seems sensible, definitely preferable to the current IndexOutOfBoundsException in such a case...

@jhoeller jhoeller merged commit 7e5aacf into spring-projects:master May 7, 2019
@jhoeller jhoeller modified the milestones: 5.1.7, 5.2 M2 May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants