You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/01/23 12:18:04 UTC

[maven-doxia] branch master updated: [DOXIA-585] propagate macro related exception and parser

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-doxia.git


The following commit(s) were added to refs/heads/master by this push:
     new d977f4e  [DOXIA-585] propagate macro related exception and parser
d977f4e is described below

commit d977f4e4f4a9f7d5549f25daa56d3cd0f756023a
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Wed Jan 23 13:18:02 2019 +0100

    [DOXIA-585] propagate macro related exception and parser
---
 .../java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
index 60372f9..dceb4f0 100644
--- a/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
+++ b/doxia-modules/doxia-module-xhtml/src/main/java/org/apache/maven/doxia/module/xhtml/XhtmlParser.java
@@ -230,7 +230,7 @@ public class XhtmlParser
 
         if ( text.startsWith( "MACRO" ) && !isSecondParsing() )
         {
-            processMacro( text, sink );
+            processMacro( parser, text, sink );
         }
         else
         {
@@ -239,7 +239,7 @@ public class XhtmlParser
     }
 
     /** process macro embedded in XHTML commment */
-    private void processMacro( String text, Sink sink )
+    private void processMacro( XmlPullParser parser, String text, Sink sink )
         throws XmlPullParserException
     {
         String s = text.substring( text.indexOf( '{' ) + 1, text.indexOf( '}' ) );
@@ -253,7 +253,8 @@ public class XhtmlParser
             String[] param = StringUtils.split( params[i], "=" );
             if ( param.length == 1 )
             {
-                throw new XmlPullParserException( "Missing 'key=value' pair for macro parameter: " + params[i] );
+                throw new XmlPullParserException( "Invalid 'key=value' pair for macro " + macroName + " parameter: "
+                    + params[i], parser, null );
             }
 
             String key = unescapeForMacro( param[0] );
@@ -269,11 +270,11 @@ public class XhtmlParser
         }
         catch ( MacroExecutionException e )
         {
-            throw new XmlPullParserException( "Unable to execute macro in the document: " + macroName );
+            throw new XmlPullParserException( "Unable to execute macro in the document: " + macroName, parser, e );
         }
         catch ( MacroNotFoundException me )
         {
-            throw new XmlPullParserException( "Macro not found: " + macroName );
+            throw new XmlPullParserException( "Macro not found: " + macroName, parser, null );
         }
     }