Author: sisbell Date: Mon Sep 1 19:18:51 2008 New Revision: 691092 URL: http://svn.apache.org/viewvc?rev=691092&view=rev Log: Fix: sub tags of sets should be allowed to be lists.
Modified: maven/shared/trunk/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java Modified: maven/shared/trunk/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java?rev=691092&r1=691091&r2=691092&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java (original) +++ maven/shared/trunk/maven-shared-model/src/main/java/org/apache/maven/shared/model/impl/DefaultModelDataSource.java Mon Sep 1 19:18:51 2008 @@ -362,9 +362,9 @@ } String subUri = p.getUri().substring( baseUri.length(), modelPropertyLength ); - if ( !uris.contains( p.getUri() ) || ( subUri.contains( "#collection" ) && - (!subUri.endsWith( "#collection" ) && !subUri.endsWith("#set")) && - ( !combineChildrenUris.contains( p.getUri() ) || p.getUri().endsWith( "#property/combine.children" ) ) ) ) + if ( !uris.contains( p.getUri() ) || ( (subUri.contains( "#collection" ) || subUri.contains("#set")) && + (!subUri.endsWith( "#collection" ) && !subUri.endsWith("#set")) && !isParentASet(subUri) && combineChildrenRule(p, combineChildrenUris) ) + ) { processedProperties.add( findLastIndexOfParent( p, processedProperties ) + 1, p ); uris.add( p.getUri() ); @@ -374,6 +374,18 @@ return processedProperties; } + private static boolean combineChildrenRule(ModelProperty mp, List<String> combineChildrenUris) { + return !combineChildrenUris.contains( mp.getUri() ) || mp.getUri().endsWith( "#property/combine.children" ) ; + } + + private static boolean isParentASet(String uri) + { + String x = uri.replaceAll("#property", "").replaceAll("/combine.children", ""); + String parentUri = (x.lastIndexOf( "/" ) > 0) + ? x.substring( 0, x.lastIndexOf( "/" ) ) : ""; + return parentUri.endsWith("#set"); + } + /** * Returns list of model properties (from the specified list of model containers) that are not contained in the data * source