--- fop-0.20.5.orig/src/org/apache/fop/apps/FOPException.java Tue Jul 15 04:03:22 2003 +++ fop-0.20.5.orig/src/org/apache/fop/apps/FOPException.java Wed Aug 25 19:27:06 2004 @@ -50,6 +50,9 @@ */ package org.apache.fop.apps; +import java.util.ArrayList; + +import org.apache.fop.fo.FObj; import org.xml.sax.SAXException; @@ -107,6 +110,12 @@ line = -1; column = -1; } + + public FOPException(String message, FObj node) + { + super(message); + node.getMarkedLocation(this); + } public FOPException(String message, Throwable e, String systemId, int line, int column) { super(message); @@ -158,6 +167,21 @@ } } + public String getSystemId() + { + return systemId; + } + + public int getLine() + { + return line; + } + + public int getColumn() + { + return column; + } + public void printStackTrace() { synchronized (System.err) { super.printStackTrace(); @@ -199,5 +223,4 @@ } } } - } --- fop-0.20.5.orig/src/org/apache/fop/fo/flow/Block.java Tue Jul 15 04:03:14 2003 +++ fop-0.20.5.orig/src/org/apache/fop/fo/flow/Block.java Wed Aug 25 19:27:33 2004 @@ -140,7 +140,7 @@ throw new FOPException( "No meaningful layout in block after many attempts. "+ "Infinite loop is assumed. Processing halted.", - systemId, line, column); + this); } // log.error(" b:LAY[" + marker + "] "); --- fop-0.20.5.orig/src/org/apache/fop/fo/FObj.java Tue Jul 15 04:03:14 2003 +++ fop-0.20.5.orig/src/org/apache/fop/fo/FObj.java Wed Aug 25 19:25:23 2004 @@ -236,5 +236,25 @@ // return new ArrayList(markers.values()); // } // } + + /** + * Record location of the downmost grandchild touched by + * layout algorithm into exception object. + * + * This location may be useful (as a hint) + * certain types of fo problems. + */ + public void getMarkedLocation(FOPException e) { + if (marker >= 0 && marker < children.size()) { + final Object child = children.get(marker); + if (child instanceof FObj) + { + final FObj fObjChild = (FObj) child; + fObjChild.getMarkedLocation(e); + return; + } + } + e.setLocation(systemId, line, column); + } }