Top "Nullpointerexception" questions

The Java exception thrown when an application attempts to use null in a case where an object is required.

JPA/Hibernate Static Metamodel Attributes not Populated -- NullPointerException

I would like to use JPA2 Criteria API with metamodel objects, which seems to be pretty easy: ... Root<JPAAlbum&…

java hibernate nullpointerexception jpa-2.0 criteria-api
Is Catching a Null Pointer Exception a Code Smell?

Recently a co-worker of mine wrote in some code to catch a null pointer exception around an entire method, and …

java nullpointerexception
listFiles() returns null when it shouldn't. It used to work properly until recently and hasn't been modified

public static void main(String[] args) throws InterruptedException { // TODO Auto-generated method stub while(true) { ArrayList<File> wallpapers = new …

java batch-file jar nullpointerexception access-rights
Proper way to handle Android Studio's NullPointerException lint warning

I'm new to android/java programming and am confused how to properly deal with this warning. Method invocation '' may …

java android nullpointerexception android-studio lint
Booleans, conditional operators and autoboxing

Why does this throw NullPointerException public static void main(String[] args) throws Exception { Boolean b = true ? returnsNull() : false; // NPE on …

java nullpointerexception boolean conditional-operator autoboxing
Why static fields are not initialized in time?

The following code prints null once. class MyClass { private static MyClass myClass = new MyClass(); private static final Object obj = new …

java static null nullpointerexception
Android fragment - findViewById returns null

I have a problem that seems to be quite common on the internet : I have created an activity with just …

android android-fragments nullpointerexception findviewbyid
Guice injection null pointer

We try to refactoring a project with Guice. The idea is to bind all the Language interface to a concreate …

java nullpointerexception guice code-injection
Adding null to empty TreeSet raising NullPointerException

import java.util.TreeSet; class Test { public static void main(String[] args) { TreeSet t=new TreeSet(); t.add(null); System.…

java nullpointerexception treeset