Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Decided to use Apache's Common Configuration package to parse an XML File.

I decided to do a:

XMLConfiguration xmlConfig = new XMLConfiguration(file);

To which Eclipse complained that I haven't caught an exception(Unhandled exception type ConfigurationException), so I hit the trusty surround with try/catch and it added the following code:

try 
    {
        XMLConfiguration xmlConfig = new XMLConfiguration(file);
    } 
    catch (ConfigurationException ex) 
    {
        ex.printStackTrace();
    }

However now it's complaining:

No exception of type ConfigurationException can be thrown; an exception type 
must be a subclass of Throwable

I don't understand why it's gave me that error when Eclipse is the one that suggested to add it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

org.apache.commons.configuration.ConfigurationException extends org.apache.commons.lang.exception.NestableException.

Do you have Commons Lang on your path also? If not, Eclipse will fail to resolve the ConfigurationException class, and you'll get that error.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...