diff options
author | sthelen <thelen.sebastian@gmail.com> | 2010-05-16 05:09:54 +0800 |
---|---|---|
committer | Mark Donszelmann <Mark.Donszelmann@gmail.com> | 2010-05-17 19:26:46 +0800 |
commit | fe4c4e7599c730ba8594d8da731894e37384fad4 (patch) | |
tree | 2a7735408b32a938f5a5687ee3a26a9be1739bd9 /src/main | |
parent | 96fbe90a6f1a1769f820da9d58ec5f49f3c065bf (diff) | |
download | maven-nar-plugin-fe4c4e7599c730ba8594d8da731894e37384fad4.tar.gz maven-nar-plugin-fe4c4e7599c730ba8594d8da731894e37384fad4.tar.bz2 maven-nar-plugin-fe4c4e7599c730ba8594d8da731894e37384fad4.tar.xz maven-nar-plugin-fe4c4e7599c730ba8594d8da731894e37384fad4.zip |
Fixed ClassCastException in NarAssemblyMojo when specifying classifiers.
The untyped List that was used before this commit lead to a ClassCastException when
it was cast to a String array in the NarManager. The mojo parameter is changed
to directly be a String array which solves the problem.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java | 3 | ||||
-rw-r--r-- | src/main/java/org/apache/maven/plugin/nar/NarManager.java | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java index 05414e8..c912743 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarAssemblyMojo.java @@ -21,6 +21,7 @@ package org.apache.maven.plugin.nar; import java.io.File; import java.io.IOException; +import java.util.Arrays; import java.util.Iterator; import java.util.List; @@ -48,7 +49,7 @@ public class NarAssemblyMojo * * @parameter */ - private List classifiers = null; + private String[] classifiers = null; /** * Copies the unpacked nar libraries and files into the projects target area diff --git a/src/main/java/org/apache/maven/plugin/nar/NarManager.java b/src/main/java/org/apache/maven/plugin/nar/NarManager.java index fd77645..4128b7f 100644 --- a/src/main/java/org/apache/maven/plugin/nar/NarManager.java +++ b/src/main/java/org/apache/maven/plugin/nar/NarManager.java @@ -147,25 +147,23 @@ public class NarManager } public final List/* <AttachedNarArtifact> */getAttachedNarDependencies( - List/* <NarArtifacts> */narArtifacts, List classifiers) + List/* <NarArtifacts> */narArtifacts, String[] classifiers) throws MojoExecutionException, MojoFailureException { - String[] types; List artifactList = new ArrayList(); - if( classifiers != null && !classifiers.isEmpty() ) + if( classifiers != null && classifiers.length > 0 ) { - types = (String[]) classifiers.toArray(); - for ( int j = 0; j < types.length; j++ ) + for ( int j = 0; j < classifiers.length; j++ ) { if ( artifactList != null ) { - artifactList.addAll( getAttachedNarDependencies( narArtifacts, types[j] )); + artifactList.addAll( getAttachedNarDependencies( narArtifacts, classifiers[j] )); } } -} + } else { artifactList.addAll( getAttachedNarDependencies( narArtifacts, ( String )null )); |