[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-distro-pkg-dev
Subject:    Re: [rfc][icedtea-web] PolicyEditor dies on invalid CLI arguments
From:       Jiri Vanek <jvanek () redhat ! com>
Date:       2015-08-21 10:17:16
Message-ID: 55D6FAAC.4060900 () redhat ! com
[Download RAW message or body]

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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic