FORUM-772 | [Sonar] Fix Critical violations reported by sonar.