maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r1000601 - in /maven/maven-3/trunk/maven-model-builder/src: main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
Date Thu, 23 Sep 2010 20:05:09 GMT
Author: bentmann
Date: Thu Sep 23 20:05:09 2010
New Revision: 1000601

URL: http://svn.apache.org/viewvc?rev=1000601&view=rev
Log:
[MNG-4837] Interpolation error due to cyclic expression for one of the POM coordinates gets
needlessly repeated

Modified:
    maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
    maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java

Modified: maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java?rev=1000601&r1=1000600&r2=1000601&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
(original)
+++ maven/maven-3/trunk/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java
Thu Sep 23 20:05:09 2010
@@ -324,6 +324,11 @@ public class StringSearchModelInterpolat
 
         private boolean isQualifiedForInterpolation( Field field, Class<?> fieldType
)
         {
+            if ( Map.class.equals( fieldType ) && "locations".equals( field.getName()
) )
+            {
+                return false;
+            }
+
             Boolean primitive = fieldIsPrimitiveByClass.get( fieldType );
             if ( primitive == null )
             {

Modified: maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java?rev=1000601&r1=1000600&r2=1000601&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
(original)
+++ maven/maven-3/trunk/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
Thu Sep 23 20:05:09 2010
@@ -19,6 +19,8 @@ package org.apache.maven.model.interpola
  * under the License.
  */
 
+import org.apache.maven.model.InputLocation;
+import org.apache.maven.model.InputSource;
 import org.apache.maven.model.Model;
 import org.apache.maven.model.building.DefaultModelBuildingRequest;
 import org.apache.maven.model.building.ModelBuildingRequest;
@@ -482,4 +484,27 @@ public class StringSearchModelInterpolat
     {
         public static final String CONSTANT = "${expression}";
     }
+
+    public void testLocationTrackerShouldBeExcludedFromInterpolation()
+    {
+        Properties props = new Properties();
+        props.setProperty( "expression", "value" );
+        DefaultModelBuildingRequest request = new DefaultModelBuildingRequest();
+        request.setUserProperties( props );
+
+        InputSource source = new InputSource();
+        source.setLocation( "${expression}" );
+        source.setModelId( "${expression}" );
+        Model model = new Model();
+        model.setLocation( "", new InputLocation( 1, 1, source ) );
+
+        SimpleProblemCollector problems = new SimpleProblemCollector();
+        StringSearchModelInterpolator interpolator = new StringSearchModelInterpolator();
+        interpolator.interpolateObject( model, model, null, request, problems );
+
+        assertProblemFree( problems );
+        assertEquals( "${expression}", source.getLocation() );
+        assertEquals( "${expression}", source.getModelId() );
+    }
+
 }



Mime
View raw message