Way to change .jar return code and avoid SONAR violation "System.exit() should not be used in J2EE/JEE apps"

StackOverflow https://stackoverflow.com/questions/22459277

  •  16-06-2023
  •  | 
  •  

문제

I have a JAR which will be scripted by others and requires custom return codes. I am using System.exit(int n) atm but SONAR complains giving a "Critical" violation.

Do Not Call System Exit: System.exit() should not be used in J2EE/JEE apps.

I believe SONAR will also complain about Runtime.exit().

Is there a way to override the JAR's return code and keep SONAR happy at the same time?

도움이 되었습니까?

해결책

You can flag any issue as "False Positive" in the sonar IDE. The offending lines of code will be ignored in later sonar runs.

Furthermore you should add a comment, which describes why you flagged this.

False Positive

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top