org.sonar.l10n.java.rules.squid.S2096.html Maven / Gradle / Ivy
The newest version!
There's no reason for a main
method to throw
anything. After all, what's going to catch it?
Instead, the method should itself gracefully handle any exceptions that may bubble up to it, attach as much contextual information as possible, and perform whatever logging or user communication is necessary.
Noncompliant Code Example
public static void main(String args[]) throws Exception { // Noncompliant
Compliant Solution
public static void main(String args[]) {
© 2015 - 2025 Weber Informatics LLC | Privacy Policy