[rfc][icedtea-web] PolicyEditor dies on invalid CLI arguments
Jiri Vanek
jvanek at redhat.com
Fri Aug 21 10:17:16 UTC 2015
On 08/19/2015 05:08 PM, Andrew Azores wrote:
> 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.
ThankYou!
Iced-Tea-Web is not consitstent with localized/hardcoded exceptions.
I'm in favour to abandon localized exceptions at all as I consider them as very evil.
Lookig to InvalidArgumentException usage - one, not localised
UnevenParameterException - one localised usage.
:(so even new patches are mingled):
I would like to encourage you to go back to hardcoded messages.
Feel free to persuade me oposite, feel free to find another vote, feel free to push it as it is, feel free to push it with hardcoded messages.
Again, thanx for contribution!
J.
More information about the distro-pkg-dev
mailing list