consider an example
public static boolean MyFunction() {
boolean isReturnNull = false;
try{
//some code
}
catch (Exception e)
{
//dosomething & log errors if needed
isReturnNull = true;
}
if(isReturnNull == true)
{
return null;
}
else
{
//return something;
}
my Sonarqube return with this critical error saying this will always be evaluated as false in the above segment pasting it below again.
{
return null;
}
Question is why isn't it checking the catch block which has it value changed to true.
Kindly help on this why its happening, sorry fot to mention its written in JAVA code.