org.sonar.l10n.java.rules.squid.S1160.html Maven / Gradle / Ivy
Using checked exceptions forces method callers to deal with errors, either by propagating them or by handling them.
This makes those exceptions fully part of the API of the method.
To keep the complexity for callers reasonable, methods should not throw more than one kind of checked exception.
Noncompliant Code Example
public void delete() throws IOException, SQLException { // Noncompliant
/* ... */
}
Compliant Solution
public void delete() throws SomeApplicationLevelException {
/* ... */
}
Exceptions
Overriding methods are not checked by this rule and are allowed to throw several checked exceptions.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy