You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2011/07/10 00:26:19 UTC
svn commit: r1144757 -
/maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectorUtils.java
Author: hboutemy
Date: Sat Jul 9 22:26:18 2011
New Revision: 1144757
URL: http://svn.apache.org/viewvc?rev=1144757&view=rev
Log:
algorithm simplification
Modified:
maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectorUtils.java
Modified: maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectorUtils.java
URL: http://svn.apache.org/viewvc/maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectorUtils.java?rev=1144757&r1=1144756&r2=1144757&view=diff
==============================================================================
--- maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectorUtils.java (original)
+++ maven/archetype/trunk/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/ArchetypeSelectorUtils.java Sat Jul 9 22:26:18 2011
@@ -70,33 +70,19 @@ public class ArchetypeSelectorUtils
for ( Map.Entry<String, List<Archetype>> entry : archetypesPerCatalog.entrySet() )
{
List<Archetype> archetypes = new ArrayList<Archetype>();
+
for ( Archetype archetype : entry.getValue() )
{
String groupId = ArchetypeSelectorUtils.extractGroupIdFromFilter( filter );
String artifactId = ArchetypeSelectorUtils.extractArtifactIdFromFilter( filter );
- if ( groupId == null )
- {
- if ( StringUtils.contains( archetype.getArtifactId(), artifactId ) )
- {
- archetypes.add( archetype );
- }
- }
- else if ( artifactId == null )
- {
- if ( StringUtils.contains( archetype.getGroupId(), groupId ) )
- {
- archetypes.add( archetype );
- }
- }
- else
+
+ if ( ( ( groupId == null ) || StringUtils.contains( archetype.getGroupId(), groupId ) )
+ && StringUtils.contains( archetype.getArtifactId(), artifactId ) )
{
- if ( StringUtils.contains( archetype.getGroupId(), groupId ) && StringUtils.contains(
- archetype.getArtifactId(), artifactId ) )
- {
- archetypes.add( archetype );
- }
+ archetypes.add( archetype );
}
}
+
if ( !archetypes.isEmpty() )
{
filtered.put( entry.getKey(), archetypes );