quality code review (SonarQube) : operation on immutable object and manage exceptions