In so far as changing c-c to have getVector() etc, I'm pretty happy with it.
Or, at least, I understand the logic and don't want to totally piss off the
users!  My problem with not throwing an exception for missing values is that
it really can bury all sorts of problems.

The whole reason for being able to return a default value:
getString("my.value","default string"); is to provide the defaults.  Doing
this: getString("my.value") and returning null is just wrong..  my app will
crash with an obscure NullPointerException somewhere just because I forgot
to specify my.value.   c-c assumes that the values are there, otherwise if
the value may/maynot be there, then user the default, or do hasKey(); to
check...

Getting a nice exception immediatly tells me that I misconfigured
something..  Maybe  teh ConfigurationFactory was wrong, or something else..
And I know where to go to fix it.  getting a NPE doesn't help so much...

While we could go with the "throw Exception,return Null" switch, it just
feels to me like it is muddying things up...  It would be better to have
explicit defaults instead, or, accept that a ConfigurationException is a
good thing when a key is missing and you aren't doing hasKey();

ERic

> -----Original Message-----
> From: Henning P. Schmiedehausen [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 07, 2004 12:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: cvs commit:
> jakarta-turbine-2/src/java/org/apache/turbine/modules/actions
> LogoutUser.java
>
>
> [EMAIL PROTECTED] writes:
>
> >seade       2004/08/26 17:59:29
>
> >  Modified:    src/java/org/apache/turbine/modules/actions Tag:
> >                        TURBINE_2_3_BRANCH LogoutUser.java
> >  Log:
> >  Commons Configuration no longer returns a default value but
> throws an exception if a property is missing and no default value
> is given.
> >  How many of these are we yet to find?
>
> Emmanuel and I basically agree, that we revert the behaviour of C-c
> back. We only need to convince Eric. ;-) However, it is still a good
> thing to spot all these.
>
> An explicit search might be nice before the 2.3.1 release. I put it on
> my todo-list.
>
> Another nit: I try to remove the usage of "magic" values in the
> code. So changing this to
>
> data.setMessage(conf.getString(TurbineConstants.LOGOUT_MESSAGE,
> TurbineConstants.LOGOUT_MESSAGE_DEFAULT));
>
> and a
>
> /** The default Logout Message */
> public static final String LOGOUT_MESSAGE_DEFAULT = "";
>
> in TurbineConstants
>
> would help with this.
>
>       Regards
>               Henning
>
> --
> Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
> [EMAIL PROTECTED]        +49 9131 50 654 0   http://www.intermeta.de/
>
> RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
>    Linux, Java, perl, Solaris -- Consulting, Training, Development
>
> "Fighting for one's political stand is an honorable action, but re-
>  fusing to acknowledge that there might be weaknesses in one's
>  position - in order to identify them so that they can be remedied -
>  is a large enough problem with the Open Source movement that it
>  deserves to be on this list of the top five problems."
>                        -- Michelle Levesque, "Fundamental Issues with
>                                     Open Source Software Development"
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to