This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch sonar in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git
commit 2233597a214ae21aaf002825ea5f6814f6e72323 Author: Piotrek Żygieło <[email protected]> AuthorDate: Sat Sep 26 08:59:23 2020 +0200 Fix some sonar findings Handle multiple exception types https://rules.sonarsource.com/java/type/Code%20Smell/RSPEC-2147 Use diamond operator https://rules.sonarsource.com/java/type/Code%20Smell/RSPEC-2293 Use @Override annotation https://rules.sonarsource.com/java/type/Code%20Smell/RSPEC-1161 Closes #3 --- .../maven/plugins/source/AbstractSourceJarMojo.java | 18 +++--------------- .../maven/plugins/source/AggregatorSourceJarMojo.java | 1 + 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java index 641bd35..a37f75e 100644 --- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java @@ -312,19 +312,7 @@ public abstract class AbstractSourceJarMojo getLog().debug( "create archive " + outputFile ); archiver.createArchive( session, project, archive ); } - catch ( IOException e ) - { - throw new MojoExecutionException( "Error creating source archive: " + e.getMessage(), e ); - } - catch ( ArchiverException e ) - { - throw new MojoExecutionException( "Error creating source archive: " + e.getMessage(), e ); - } - catch ( DependencyResolutionRequiredException e ) - { - throw new MojoExecutionException( "Error creating source archive: " + e.getMessage(), e ); - } - catch ( ManifestException e ) + catch ( IOException | ArchiverException | DependencyResolutionRequiredException | ManifestException e ) { throw new MojoExecutionException( "Error creating source archive: " + e.getMessage(), e ); } @@ -528,7 +516,7 @@ public abstract class AbstractSourceJarMojo */ private String[] getCombinedIncludes( List<String> additionalIncludes ) { - List<String> combinedIncludes = new ArrayList<String>(); + List<String> combinedIncludes = new ArrayList<>(); if ( includes != null && includes.length > 0 ) { @@ -559,7 +547,7 @@ public abstract class AbstractSourceJarMojo private String[] getCombinedExcludes( List<String> additionalExcludes ) { - List<String> combinedExcludes = new ArrayList<String>(); + List<String> combinedExcludes = new ArrayList<>(); if ( useDefaultExcludes ) { diff --git a/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java index 1a291ef..bb7300c 100644 --- a/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java @@ -37,6 +37,7 @@ public class AggregatorSourceJarMojo /** * {@inheritDoc} */ + @Override public void execute() throws MojoExecutionException {
