, . { }, -
void foo() {
{
Ini myIni = new Ini(new FileReader(myFile));
}
myIni.get("toto");
}
, myIni , , , myIni.get("toto"); NullPointerException.
, , catch.
null:
Ini myIni = null;
try {
myIni = new Ini(new FileReader(myFile));
} catch (IOException e) {
e.printStackTrace();
}
if( myIni != null ) {
myIni.get("toto");
} else {
}
:
Ini myIni = null;
try {
myIni = new Ini(new FileReader(myFile));
} catch (IOException e) {
e.printStackTrace();
throw new MyCustomInitFailedException();
}
myIni.get("toto");
@khachik, try myIni, . , .