commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [Configuration] Configuration throws no exceptions...
Date Mon, 11 Sep 2006 20:18:28 GMT
Mark Diggory wrote:
> Hello Friends,
> 
> I notice that the code for AbstractConfiguration eats exceptions that 
> the javadoc claims it should throw.
> 
> http://jakarta.apache.org/commons/configuration/xref/org/apache/commons/configuration/AbstractConfiguration.html#692

> 
> 
>> /***
>> 690      * {@inheritDoc}
>> 691      */
>> 692     public Integer getInteger(String key, Integer defaultValue)
>> 693     {
>> 694         Object value = resolveContainerStore(key);
>> 695
>> 696         if (value == null)
>> 697         {
>> 698             return defaultValue;
>> 699         }
>> 700         else
>> 701         {
>> 702             try
>> 703             {
>> 704                 return 
>> PropertyConverter.toInteger(interpolate(value));
>> 705             }
>> 706             catch (ConversionException e)
>> 707             {
>> 708                 throw new ConversionException('\'' + key + "' 
>> doesn't map to an Integer object", e);
>> 709             }
>> 710         }
>> 711     }
> 
> How is it that this can compile when the method signature clearly 
> doesn't shoe "throws ConfigurationException" ? I thought, maybe its an 
> extension of RuntimeException, but it doesn't appear so.
> 
> Cheers,
> Mark
> 
ConversionException extends ConfigurationRuntimeException, which extends 
the runtime exception NestableRuntimeException (from the [lang] 
project). So it is indeed a runtime exception.

The exception is not eaten, but a more specific message is added.

Oliver

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


Mime
View raw message