fix property value leak in DefaultParser.handleProperties - #441
Open
rootvector2 wants to merge 1 commit into
Open
rootvector2 wants to merge 1 commit into
rootvector2 wants to merge 1 commit into
Conversation
handleProperties applied the Properties value to the Option registered in Options instead of the copy that handleOption adds to the CommandLine, so the value survived the parse() call and every later parse() on the same Options reused it, even when the option was given on the command line.
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.
handlePropertiescallsprocessValueon theOptionregistered inOptionsinstead of on the copy thathandleOptionclones into theCommandLine, so a default applied in oneparse()stays on the sharedOptionsand every laterparse()on it returns that stale value while an explicit-a twoon the command line is pushed into the args list; found while checking whyDefaultParsernever clears option values the way the legacyParserdoes for CLI-71.mvn; that'smvnon the command line by itself.