Solve some style issues, substitute NullPointerException with IllegalArgumentException.