From ded24c942b053a82b60d462028449da1fc316b6e Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 3 Dec 2007 10:16:27 +0000 Subject: [PATCH] Log RuntimeExceptions during rendering so that they are at least visible somewhere if someone doesn't set an ErrorListener on the XSLT processor (this could lead to exceptions being swallowed). This is a temporary measure until we have time to improve the exception handling in FOP. The original problem that led to this change was: "The number of this PDFNumber must not be empty" while producing a PDF/A with customized filter entries in the PDF configuration. The exception was a follow-up exception after a PDFConformanceException that was swallowed by a default ErrorListener. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@600467 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/RenderPagesModel.java | 6 +++--- src/java/org/apache/fop/pdf/PDFObject.java | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/fop/area/RenderPagesModel.java b/src/java/org/apache/fop/area/RenderPagesModel.java index 81ffac746..a5257977a 100644 --- a/src/java/org/apache/fop/area/RenderPagesModel.java +++ b/src/java/org/apache/fop/area/RenderPagesModel.java @@ -22,13 +22,11 @@ package org.apache.fop.area; // Java import java.io.IOException; import java.io.OutputStream; -import java.util.List; import java.util.Iterator; +import java.util.List; -// XML import org.xml.sax.SAXException; -// FOP import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fonts.FontInfo; @@ -119,6 +117,8 @@ public class RenderPagesModel extends AreaTreeModel { try { renderer.renderPage(page); } catch (RuntimeException re) { + String err = "Error while rendering page " + page.getPageNumberString(); + log.error(err, re); throw re; } catch (Exception e) { //TODO use error handler to handle this FOP or IO Exception or propagate exception diff --git a/src/java/org/apache/fop/pdf/PDFObject.java b/src/java/org/apache/fop/pdf/PDFObject.java index 8152fcd83..cab6b75f2 100644 --- a/src/java/org/apache/fop/pdf/PDFObject.java +++ b/src/java/org/apache/fop/pdf/PDFObject.java @@ -83,7 +83,9 @@ public abstract class PDFObject implements PDFWritable { */ public void setObjectNumber(int objnum) { this.objnum = objnum; - log.trace("Assigning " + this + " object number " + objnum); + if (log.isTraceEnabled()) { + log.trace("Assigning " + this + " object number " + objnum); + } } /** -- 2.39.5