【发布时间】:2011-01-25 21:30:06
【问题描述】:
决定使用 Apache 的通用配置包来解析一个 XML 文件。
我决定做一个:
XMLConfiguration xmlConfig = new XMLConfiguration(file);
Eclipse 抱怨我没有捕获异常(Unhandled exception type ConfigurationException),所以我点击了可信赖的surround with try/catch,它添加了以下代码:
try
{
XMLConfiguration xmlConfig = new XMLConfiguration(file);
}
catch (ConfigurationException ex)
{
ex.printStackTrace();
}
但是现在它在抱怨:
No exception of type ConfigurationException can be thrown; an exception type
must be a subclass of Throwable
当 Eclipse 是建议添加它的那个时,我不明白为什么它给了我这个错误。
【问题讨论】:
标签: java apache-commons