[rfc][icedtea-web] PolicyEditor dies on invalid CLI arguments

Jiri Vanek jvanek at redhat.com
Wed Aug 19 12:26:09 UTC 2015


snip
>> This does not seems right.p
>> ITs deffined as:
>> PRINCIPALS("-principals", "class_name principal_name", "PBOPrincipals",
>> NumberOfArguments.EVEN_NUMBER_SUPPORTS_EQUALS_CHAR);
>>
>> So even should be already thrown.
>
> Yes, the OptionParser does actually throw an UnevenParameterException in this case (which
> PolicyEditorTest.testGetPrincipalsArgumentWhenUnevenArgumentsProvided actually expects), but I added
> the check there as well just as a defensive measure.
>

Please dont do this. the exception is thrown, so do not add code which never will be used. And if 
will be then its hiding missbehaving somewhere else.

Please rmowe redundant check and rthrow.
>> Also the test for case like
>>         String[] args = new String[] { "-principals", "aa", "bb" };
>> is missing.
>>
> Ah good catch, thank you. Added.
>
>> Thanx!
>>   J.
>>>
>>
>
>



More information about the distro-pkg-dev mailing list