You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/11/23 16:28:03 UTC

svn commit: r719994 - /maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java

Author: bentmann
Date: Sun Nov 23 07:28:02 2008
New Revision: 719994

URL: http://svn.apache.org/viewvc?rev=719994&view=rev
Log:
o Compensated for Velocity errors from old Doxia versions

Modified:
    maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java

Modified: maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java?rev=719994&r1=719993&r2=719994&view=diff
==============================================================================
--- maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java (original)
+++ maven/shared/trunk/maven-verifier/src/main/java/org/apache/maven/it/Verifier.java Sun Nov 23 07:28:02 2008
@@ -246,7 +246,7 @@
             String line = (String) i.next();
 
             // A hack to keep stupid velocity resource loader errors from triggering failure
-            if ( line.indexOf( "[ERROR]" ) >= 0 && line.indexOf( "VM_global_library.vm" ) == -1 )
+            if ( line.indexOf( "[ERROR]" ) >= 0 && !isVelocityError( line ) )
             {
                 throw new VerificationException( "Error in execution: " + line );
             }
@@ -254,6 +254,27 @@
     }
 
     /**
+     * Checks whether the specified line is just an error message from Velocity. Especially old versions of Doxia employ
+     * a very noisy Velocity instance.
+     * 
+     * @param line The log line to check, must not be <code>null</code>.
+     * @return <code>true</code> if the line appears to be a Velocity error, <code>false</code> otherwise.
+     */
+    private static boolean isVelocityError( String line )
+    {
+        if ( line.indexOf( "VM_global_library.vm" ) >= 0 )
+        {
+            return true;
+        }
+        if ( line.indexOf( "VM #" ) >= 0 && line.indexOf( "macro" ) >= 0 )
+        {
+            // [ERROR] VM #displayTree: error : too few arguments to macro. Wanted 2 got 0
+            return true;
+        }
+        return false;
+    }
+
+    /**
      * Throws an exception if the text is not present in the log.
      * @param text
      * @throws VerificationException