[rfc][icedtea-web] PolicyEditor dies on invalid CLI arguments
Andrew Azores
aazores at redhat.com
Wed Aug 19 15:08:32 UTC 2015
On 19/08/15 08:26 AM, Jiri Vanek wrote:
> 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.
>>>>
>>>
>>
>>
>
Okay, updated patch attached. I also extracted some hardcoded exception
strings into messages.properties.
--
Thanks,
Andrew Azores
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exception-on-invalid-selector-3.patch
Type: text/x-patch
Size: 11799 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20150819/26979e9f/exception-on-invalid-selector-3-0001.patch>
More information about the distro-pkg-dev
mailing list