NullPointerExceptionをキャッチすることは、NULLポインタの再参照を防ぐためのプログラム的なチェックの代替として使用すべきではありません。
プログラマーは通常、以下の3つの状況でNullPointerExceptionをキャッチする:
この3つの状況のうち、許容できるのは最後の状況だけです。
Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.
Programmers typically catch NullPointerException under three circumstances:
Of these three circumstances, only the last is acceptable.