Java : Null dereference on some path