public class SupplierCalculatorApplet extends JApplet{
...
public void init(){
loadProperties();
...
}
...
private void loadProperties() {
language = "en-us";//getParameter("Language");
prop = new Properties();
try {
URL urlToProps = this.getClass().getResource("config/" + language + ".properties");
prop.load(urlToProps.openStream());//Exception Caught Here
} catch (IOException e) {
}
}
在上面指示的行中发现异常。无论语言是否是有效的属性文件,我都会在同一行捕获相同的异常。
你们没有给我们太多的合作机会,但我的猜测是urlToProps
is null
, since Class#getResource回报null
如果找不到资源,但您在图中的代码中没有防御性检查。所以urlToProps.openStream()
部分会抛出 NPE。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)