maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1567425 - in /maven/shared/trunk/maven-filtering/src: main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java
Date Tue, 11 Feb 2014 22:30:39 GMT
Author: rfscholte
Date: Tue Feb 11 22:30:39 2014
New Revision: 1567425

URL: http://svn.apache.org/r1567425
Log:
[MSHARED-199] Filtering doesn't work if 2 delimiters are used on the same line, the first
one being left open

Modified:
    maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java
    maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java

Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java?rev=1567425&r1=1567424&r2=1567425&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java
(original)
+++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java
Tue Feb 11 22:30:39 2014
@@ -410,6 +410,12 @@ public class MultiDelimiterInterpolatorF
                 throw error;
             }
         }
+        else
+        {
+            // no endtoken? Write current char and continue in search for next expression
+            in.reset();
+            return in.read();
+        }
 
         // write away the value if present, otherwise the key unmodified
         if ( value != null )

Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java?rev=1567425&r1=1567424&r2=1567425&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java
(original)
+++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java
Tue Feb 11 22:30:39 2014
@@ -176,4 +176,20 @@ public class DefaultMavenFileFilterTest
         reader = wrappers.get( 0 ).getReader( new StringReader( "abcFILTER.a.MEabc" ) );
         assertEquals( "DONE", IOUtil.toString( reader ) );
     }
+    
+    // MSHARED-199: Filtering doesn't work if 2 delimiters are used on the same line, the
first one being left open
+    public void testLineWithSingleAtAndExpression() throws Exception
+    {
+        MavenFileFilter mavenFileFilter = (MavenFileFilter) lookup( MavenFileFilter.class.getName(),
"default" );
+
+        AbstractMavenFilteringRequest req = new AbstractMavenFilteringRequest();
+        Properties additionalProperties = new Properties();
+        additionalProperties.setProperty( "foo", "bar" );
+        req.setAdditionalProperties( additionalProperties );
+
+        List<FilterWrapper> wrappers = mavenFileFilter.getDefaultFilterWrappers( req
);
+
+        Reader reader = wrappers.get( 0 ).getReader( new StringReader( "toto@titi.com ${foo}"
) );
+        assertEquals( "toto@titi.com bar", IOUtil.toString( reader ) );
+    }
 }



Mime
View raw message