sonar fix:not capturing npe