All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.squidjava.rules.squid.S00112.html Maven / Gradle / Ivy

Using such generic exception prevents calling methods from handling differently each kind of error.

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");
}

Exceptions

Generic exceptions in signature of overriding methods are excluded

@Override
public void myMethod() throws Exception {...}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy