vendredi 4 décembre 2015

Get() pattern to avoid nullPointerException

I have get link like this:

record.getRootElement().getChild("Data").getAttributeValue("attr");

And this getters can return null. Is there some pattern to avoid this exception without checking all results?

Aucun commentaire:

Enregistrer un commentaire