maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r508151 - in /maven/components/trunk/maven-core/src: main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
Date Thu, 15 Feb 2007 21:15:36 GMT
Author: jdcasey
Date: Thu Feb 15 13:15:36 2007
New Revision: 508151

URL: http://svn.apache.org/viewvc?view=rev&rev=508151
Log:
Fixing problem with unresolved sub-expressions being converted to 'null'.

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java?view=diff&rev=508151&r1=508150&r2=508151
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
Thu Feb 15 13:15:36 2007
@@ -133,7 +133,16 @@
                     }
                     else
                     {
-                        retVal += evaluate( expr.substring( index, lastIndex + 1 ) );
+                        Object subResult = evaluate( expr.substring( index, lastIndex + 1
) );
+                        
+                        if ( subResult != null )
+                        {
+                            retVal += subResult;
+                        }
+                        else
+                        {
+                            retVal += "$" + expr.substring( index + 1, lastIndex + 1 );
+                        }
                     }
                     
                     retVal += evaluate( expr.substring( lastIndex + 1 ) );

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java?view=diff&rev=508151&r1=508150&r2=508151
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
(original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
Thu Feb 15 13:15:36 2007
@@ -125,6 +125,20 @@
 
         assertEquals( "test with version: 1", value );
     }
+    
+    public void testMissingPOMPropertyRefInLargerExpression()
+        throws Exception
+    {
+        String expr = "/path/to/someproject-${baseVersion}";
+        
+        MavenProject project = new MavenProject( new Model() );
+        
+        ExpressionEvaluator ee = createExpressionEvaluator( project, null, new Properties()
);
+
+        Object value = ee.evaluate( expr );
+        
+        assertEquals( expr, value );
+    }
 
     public void testPOMPropertyExtractionWithMissingProject_WithDotNotation()
         throws Exception



Mime
View raw message