From fe4c4e7599c730ba8594d8da731894e37384fad4 Mon Sep 17 00:00:00 2001 From: sthelen Date: Sun, 16 May 2010 05:09:54 +0800 Subject: 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. --- .../java/org/apache/maven/plugin/nar/NarAssemblyMojo.java | 3 ++- src/main/java/org/apache/maven/plugin/nar/NarManager.java | 12 +++++------- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/main/java/org') 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/* */getAttachedNarDependencies( - List/* */narArtifacts, List classifiers) + List/* */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 )); -- cgit v1.2.3