58
59 @Bean
60 public AuthenticationManager authenticationManager(
61 HttpSecurity http, BCryptPasswordEncoder bCryptPasswordEncoder) throws Exception { 62 return http.getSharedObject(AuthenticationManagerBuilder.class)
63 .userDetailsService(
64 username ->
73 }
74
75 @Bean
76 public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { 77 // Enable CORS and disable CSRF
78 http.cors().and().csrf().disable();
79
166 // Expose authentication manager bean
167 @Bean
168 public AuthenticationManager authenticationManager(
169 AuthenticationConfiguration authenticationConfiguration) throws Exception {170 return authenticationConfiguration.getAuthenticationManager();
171 }
172}
95 }
96 }
97
98 private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
100 String username = System.getenv("MVNW_USERNAME");
101 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 { ... }