Copy the Option before applying property values in handleProperties#433
Open
farkhalit wants to merge 1 commit into
Open
Copy the Option before applying property values in handleProperties#433farkhalit wants to merge 1 commit into
farkhalit wants to merge 1 commit into
Conversation
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.
DefaultParser.handlePropertiescallsprocessValueon theOptioninstance owned by the caller'sOptionsrather than on a copy, so a value that arrives through the defaultsPropertiesis written into the sharedOptionand stays there after the parse. Reuse that sameOptionsfor a second parse and theisValuesEmptyguard silently serves the first parse's value instead of the second one's, the value remains readable throughoptions.getOption(...), and two threads parsing at once write the same values list.Parser.processPropertieshas the same write-through and also puts the sharedOptionon theCommandLine, so a later parse rewrites what an earlierCommandLinereturns.Both property paths now clone before storing the value, which is what the argv paths already do in
handleOptionandprocessArgs. The new test inAbstractParserTestCasefails forDefaultParser,BasicParser,GnuParserandPosixParserwithout the change.mvn; that'smvnon the command line by itself.