maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r931545 - /maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
Date Wed, 07 Apr 2010 13:44:18 GMT
Author: bentmann
Date: Wed Apr  7 13:44:18 2010
New Revision: 931545

URL: http://svn.apache.org/viewvc?rev=931545&view=rev
Log:
[MNG-4625] Interpolation of settings.xml fails if an expression's value contains XML markup

Modified:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java?rev=931545&r1=931544&r2=931545&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
(original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuilder.java
Wed Apr  7 13:44:18 2010
@@ -38,6 +38,7 @@ import org.codehaus.plexus.component.ann
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.interpolation.EnvarBasedValueSource;
 import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
 import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
 import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
 
@@ -189,6 +190,20 @@ public class DefaultSettingsBuilder
                 + e.getMessage(), -1, -1, e );
         }
 
+        interpolator.addPostProcessor( new InterpolationPostProcessor()
+        {
+            public Object execute( String expression, Object value )
+            {
+                if ( value != null )
+                {
+                    // we're going to parse this back in as XML so we need to escape XML
markup
+                    value = value.toString().replace( "&", "&amp;" ).replace( "<",
"&lt;" ).replace( ">", "&gt;" );
+                    return value;
+                }
+                return null;
+            }
+        } );
+
         try
         {
             serializedSettings = interpolator.interpolate( serializedSettings, "settings"
);



Mime
View raw message