Nettoyage sur les conseils de SonarQube
Vulnerability : Define and throw a dedicated exception instead of using a generic one. Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors. Noncompliant Code Example public void foo(String bar) throws Throwable { // Noncompliant throw new RuntimeException("My Message"); // Noncompliant } Compliant Solution public void foo(String bar) { throw new MyOwnRuntimeException("My Message"); }
Showing
1 changed file
with
3 additions
and
3 deletions
-
Please register or login to post a comment