最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Why is my variable not been checked in sonarqube even though value is assigned inside catch block - Stack Overflow

programmeradmin1浏览0评论

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论