A NullPointerException is thrown in case of an attempt to dereference a null value. The dereference may be a function call, a read or write of a field, or an array access. An ANDROID.NPE error is reported for Android-specific null pointer dereference situations.

Example 1

17     protected void onCreate(Bundle bundle) {
18         super.onCreate(bundle);
19         setContentView(R.layout.note_layout);
20         final ImageView image = (ImageView) findViewById(;
22         final String title = bundle.getString(TITLE);
23         setTitle(title);
24     }

ANDROID.NPE is reported for line 22 since 'bundle' might be null in the 'onCreate()' method due to the contract.

Security training

Application security training materials provided by Secure Code Warrior.


This checker can be extended through the Klocwork knowledge base. See Tuning Java analysis for more information.