Hi, Please see my comment in the ticket.
Gary On Sun, Aug 13, 2023, 9:04 AM Sruteesh Kumar <sruteesh....@protonmail.com.invalid> wrote: > > Hi Gary, the unit test is already provided as a comment in the JIRA issue > CLI-317. Go through the following link for the same > > > https://issues.apache.org/jira/projects/CLI/issues/CLI-317?filter=allopenissues > > > ------- Original Message ------- > On Sunday, August 13th, 2023 at 5:51 PM, Gary Gregory < > garydgreg...@gmail.com> wrote: > > > > Hello, > > > > It would be helpful to understand the upshot of this if you could express > > your explanation as a failing unit test. > > > > TY, > > Gary > > > > On Sat, Aug 12, 2023, 1:44 AM Sruteesh Kumar > > sruteesh....@protonmail.com.invalid wrote: > > > > > In the DefaultParser class, we are using handleOption method which is > > > defined as following > > > > > > privatevoidhandleOption(Optionoption)throwsParseException{ > > > > > > // check the previous option before handling the next one > > > > > > checkRequiredArgs(); > > > > > > option=(Option)option.clone(); > > > > > > updateRequiredOptions(option); > > > > > > cmd.addOption(option); > > > > > > if(option.hasArg()){ > > > > > > currentOption=option; > > > > > > }else{ > > > > > > currentOption=null; > > > > > > } > > > > > > } > > > > > > option.hasArg() returns true only when argCount is greater than 0 or is > > > UNLIMITED_VALUES. > > > But, if our option is built with optionalArg(true), then argCount seems > > > UNINITIALIZED. > > > So, if our option is built with optionalArg(true), handleOption(option) > > > sets currentOption to null which we aren't handling at DefaultParser > class > > > LIne 484 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > >