fix sonar problems
introduce local variable instead of modifying method parameter
fix sonar problems