maven-doxia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vsive...@apache.org
Subject svn commit: r619850 - /maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java
Date Fri, 08 Feb 2008 11:58:29 GMT
Author: vsiveton
Date: Fri Feb  8 03:58:28 2008
New Revision: 619850

URL: http://svn.apache.org/viewvc?rev=619850&view=rev
Log:
o improved nested exception

Modified:
    maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java

Modified: maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java?rev=619850&r1=619849&r2=619850&view=diff
==============================================================================
--- maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java
(original)
+++ maven/doxia/doxia-sitetools/trunk/doxia-doc-renderer/src/main/java/org/apache/maven/doxia/docrenderer/pdf/fo/FoPdfRenderer.java
Fri Feb  8 03:58:28 2008
@@ -37,6 +37,7 @@
 import org.apache.maven.doxia.module.fo.FoUtils;
 
 import org.codehaus.plexus.util.StringUtils;
+import org.xml.sax.SAXParseException;
 
 /**
  * PDF renderer that uses Doxia's FO module.
@@ -53,7 +54,7 @@
      * @param foFile the FO file.
      * @param pdfFile the target PDF file.
      * @throws DocumentRendererException In case of a conversion problem.
-     * @see org.apache.maven.doxia.module.fo.FoUtils#convertFO2PDF(File,File,String);
+     * @see org.apache.maven.doxia.module.fo.FoUtils#convertFO2PDF(File, File, String)
      */
     public void generatePdf( File foFile, File pdfFile )
         throws DocumentRendererException
@@ -66,6 +67,18 @@
         }
         catch ( TransformerException e )
         {
+            if ( ( e.getCause() != null ) && ( e.getCause() instanceof SAXParseException
) )
+            {
+                SAXParseException sax = (SAXParseException) e.getCause();
+
+                StringBuffer sb = new StringBuffer();
+                sb.append( "Error creating PDF from " ).append( foFile.getAbsolutePath()
).append( ":" )
+                    .append( sax.getLineNumber() ).append( ":" ).append( sax.getColumnNumber()
).append( "\n" );
+                sb.append( e.getMessage() );
+
+                throw new DocumentRendererException( sb.toString() );
+            }
+
             throw new DocumentRendererException( "Error creating PDF from " + foFile + ":
" + e.getMessage() );
         }
     }



Mime
View raw message