FindBugs uses static analysis to look for bugs in Java code. You could get good tips about improving your code, but it cannot guarantee you will detect memory leaks or NullPointerExceptions due to the runtime nature of both kind of problems. Certainly you will get very good tips about avoiding bad practices that could cause memory leaks and null pointers, but it is just a starting point.
Also check this question about finding memory leaks in Java.
The following Findbugs checks helps avoiding NullPointerException:
- NP: Method with Boolean return type returns explicit null
- NP: Clone method may return null
- NP: equals() method does not check for null argument
- NP: toString method may return null
- NP: Null pointer dereference
- NP: Null pointer dereference in method on exception path
- NP: Method does not check for null argument
- NP: close() invoked on a value that is always null
- NP: Null value is guaranteed to be dereferenced
- NP: Value is null and guaranteed to be dereferenced on exception path
- NP: Method call passes null to a nonnull parameter
- NP: Method may return null, but is declared @NonNull
- NP: A known null value is checked to see if it is an instance of a type
- NP: Possible null pointer dereference
- NP: Possible null pointer dereference in method on exception path
- NP: Method call passes null for nonnull parameter
- NP: Method call passes null for nonnull parameter
- NP: Non-virtual method call passes null for nonnull parameter
- NP: Store of null value into field annotated NonNull
- NP: Read of unwritten field
- NP: Dereference of the result of readLine() without nullcheck
- NP: Immediate dereference of the result of readLine()
- NP: Load of known null value
- NP: Possible null pointer dereference due to return value of called method
- NP: Possible null pointer dereference on branch that might be infeasible
- NP: Parameter must be nonnull but is marked as nullable
- NP: Read of unwritten public or protected field
Some checks about memory issues that will help improve your code are
- Dm: Method invokes inefficient new String(String) constructor
- Dm: Method invokes inefficient new String() constructor
- Dm: Method invokes inefficient Boolean constructor; use Boolean.valueOf(...) instead