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

Reply via email to