Fix for IT 3833. New implementation does multiple interpolation iterations, until it detects that there is no longer a change in the list.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@713266 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-11-12 05:17:42 +00:00
parent f261031443
commit cac8f6eedf
2 changed files with 17 additions and 14 deletions

View File

@ -210,7 +210,7 @@ public final class ModelProperty
* *
* @param property the interpolator property used to resolve * @param property the interpolator property used to resolve
*/ */
public void resolveWith( InterpolatorProperty property ) public boolean resolveWith( InterpolatorProperty property )
{ {
if ( property == null ) if ( property == null )
{ {
@ -218,12 +218,14 @@ public final class ModelProperty
} }
if ( isResolved() ) if ( isResolved() )
{ {
return; return false;
} }
boolean resolved = false;
for ( String expression : unresolvedExpressions ) for ( String expression : unresolvedExpressions )
{ {
if ( property.getKey().equals( expression ) ) if ( property.getKey().equals( expression ) )
{ {
resolved = true;
resolvedValue = resolvedValue.replace( property.getKey(), property.getValue() ); resolvedValue = resolvedValue.replace( property.getKey(), property.getValue() );
unresolvedExpressions.clear(); unresolvedExpressions.clear();
Matcher matcher = EXPRESSION_PATTERN.matcher( resolvedValue ); Matcher matcher = EXPRESSION_PATTERN.matcher( resolvedValue );
@ -234,6 +236,7 @@ public final class ModelProperty
break; break;
} }
} }
return resolved;
} }
public String toString() public String toString()

View File

@ -147,24 +147,24 @@ public final class ModelTransformerContext
LinkedHashSet<InterpolatorProperty> ips = new LinkedHashSet<InterpolatorProperty>(); LinkedHashSet<InterpolatorProperty> ips = new LinkedHashSet<InterpolatorProperty>();
ips.addAll(interpolatorProperties); ips.addAll(interpolatorProperties);
boolean continueInterpolation = true;
for ( InterpolatorProperty ip : ips) while(continueInterpolation)
{ {
for ( ModelProperty mp : unresolvedProperties ) continueInterpolation = false;
for ( InterpolatorProperty ip : ips)
{ {
mp.resolveWith(ip); for ( ModelProperty mp : unresolvedProperties )
} {
} if(mp.resolveWith(ip) && !continueInterpolation )
{
for ( InterpolatorProperty ip : ips ) continueInterpolation = true;
{ }
for ( ModelProperty mp : unresolvedProperties ) }
{
mp.resolveWith(ip);
} }
} }
} }
/** /**
* Transforms the specified model properties using the specified transformers. * Transforms the specified model properties using the specified transformers.
* *