Repository navigation
fix property value leak in DefaultParser.handleProperties - #441
rootvector2 wants to merge 2 commits 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.
|
One regression to account for: this removes the existing |
Only apply the Properties value to the cloned option when it has no value yet, so an option registered with a preset value keeps it instead of failing with 'Cannot add value, list full.'
|
Good catch, the clone keeps the preset value so |
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.