SONAR-5910 fix methods contracts and possible NPE