Fix coding violations reported by Sonar.