What do i choose when wanting to throw an NullPointerException?
1)
if(parameter != null){
// do something
} else {
Log.error("Reason for Exception.");
throw new NullPointerException();
}
2)
try{
// do something
} catch (NullPointerException npe) {
Log.error("Reson for Exception.");
throw npe;
}
Aucun commentaire:
Enregistrer un commentaire