The getTask method returns a long and as far as I understand it: primitive types in Java can't be null.