94 }
95 }
96
97 private static void downloadFileFromURL(String urlString, File destination) throws Exception { 98 if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 String username = System.getenv("MVNW_USERNAME");
100 char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
throws
clauses should not contain generic exception types such as Throwable
, Exception
, or RuntimeException
.
Instead, extend RuntimeException
and create more specific exception types which are relevant to your use case.
This issue will be reported for method and constructor declarations with throws
clauses that contain any of the following exception types:
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
Avoid using overly generic exception types:
public float getPercent() throws RuntimeException { ... }
Use a more specific exception type instead.
class CalculationException extends RuntimeException {
// ...
}
// ...
public float getPercent() throws CalculationException { ... }