On Sep 11, 2006, at 4:18 PM, Oliver Heger wrote:
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 * [EMAIL PROTECTED]
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
Of course, your very right, I was confusing ConversionException with
ConfigurationException and banging my head against the wall as to why
I couldn't catch it without a compilation error, duh! Thanks for
answering such a foolish question. ;-)
-Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]