Collapse catch clauses

Use multi-catch for exceptions whenever possible.

See gh-9781
This commit is contained in:
Emanuel Campolo
2017-07-18 11:52:47 -03:00
committed by Phillip Webb
parent 4a189bdee7
commit 798fe5ed53
17 changed files with 19 additions and 76 deletions

View File

@@ -371,9 +371,6 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
addDependencies(urls);
return urls.toArray(new URL[urls.size()]);
}
catch (MalformedURLException ex) {
throw new MojoExecutionException("Unable to build classpath", ex);
}
catch (IOException ex) {
throw new MojoExecutionException("Unable to build classpath", ex);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,10 +73,7 @@ class SpringApplicationAdminClient {
throw new MojoExecutionException("Failed to retrieve Ready attribute",
ex.getCause());
}
catch (MBeanException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
catch (IOException ex) {
catch (MBeanException | IOException ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}
}

View File

@@ -94,11 +94,7 @@ public class StartMojo extends AbstractRunMojo {
try {
waitForSpringApplication();
}
catch (MojoExecutionException ex) {
runProcess.kill();
throw ex;
}
catch (MojoFailureException ex) {
catch (MojoExecutionException | MojoFailureException ex) {
runProcess.kill();
throw ex;
}