commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [configuration] no exception on missing key
Date Thu, 25 Aug 2005 18:09:05 GMT
You are right, Moran, setting the throwExceptionOnMissing flag should do 
the trick.

However we should rework the javadocs for the Configuration getter 
methods. They in fact claim that an exception is always thrown for 
missing properties!


Moran Ben-David wrote:

>Try checking the value returned by 
>	AbstractConfiguratin.isThrowExceptionOnMissing()
>If it is false, then that might explain why you weren't getting an
>exception.  Try calling setThrowExceptionOnMissing(true) in that case to get
>the behaviour you're looking for.
>>-----Original Message-----
>>From: []
>>Sent: Wednesday, August 24, 2005 1:30 PM
>>Subject: [configuration] no exception on missing key
>>The documentation says that getString() throws a
>>NoSuchElementException "if the key doesn't map to an existing object."
>>I'm not getting any exception when I tested this by deleting the key
>>from my .xml file.  For example, in the following, I deleted the whole
>><url> line and didn't get an exception when I did a getString("ldap.url").
>><?xml version="1.0" encoding="ISO-8859-1" ?>
>>    <ldap>
>>	<url>ldap://</url>
>>	<base>ou=people, dc=berkeley, dc=edu</base>
>>	<uid>uid=name, ou=applications, dc=berkeley, dc=edu</uid>
>>	<password>secret</password>
>>    </ldap>
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message