commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@t-online.de>
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!

Oliver

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.
>
>Moran
>
>
>
>  
>
>>-----Original Message-----
>>From: rusty@grunt.berkeley.edu [mailto:rusty@grunt.berkeley.edu]
>>Sent: Wednesday, August 24, 2005 1:30 PM
>>To: commons-user@jakarta.apache.org
>>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" ?>
>>
>><config>
>>    <ldap>
>>	<url>ldap://caldir.berkeley.edu:636</url>
>>	<base>ou=people, dc=berkeley, dc=edu</base>
>>	<uid>uid=name, ou=applications, dc=berkeley, dc=edu</uid>
>>	<password>secret</password>
>>    </ldap>
>></config>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message