A recent thread discussed the problem of EPS files causing an error
when repeatedly processing an FO document.

I have had the same problem, but not in a servlet.  My application
uses a static XML document and a compiled stylesheet.  I have a loop
that sets new parameter values, generates a new FO document (using
Xalan), and runs Fop.  The Fop part of the loop body looks like this:

    fopDriver.reset();
    fopDriver.setInputSource
        (new InputSource(new CharArrayReader(foBuffer.toCharArray())));
    fopDriver.setOutputStream(new FileOutputStream(pdfFileName));
    fopDriver.run();

(foBuffer is the FO character stream generated earlier in the loop body.)

It always makes one PDF file, then starts formatting the
second document but exits with the following error messages:

Exception in thread "main" org.apache.fop.apps.FOPException
        at org.apache.fop.apps.Driver.render(Driver.java, Compiled Code)
        at org.apache.fop.apps.Driver.run(Driver.java, Compiled Code)
        at MMerge.main(MMerge.java, Compiled Code)

---------

java.lang.NullPointerException
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java, Compiled 
Code)
        at org.apache.fop.apps.Driver.render(Driver.java, Compiled Code)
        at org.apache.fop.apps.Driver.run(Driver.java, Compiled Code)
        at MMerge.main(MMerge.java, Compiled Code)

---------

java.lang.NullPointerException
        at org.apache.fop.pdf.PDFXObject.output(PDFXObject.java, Compiled Code)
        at org.apache.fop.pdf.PDFDocument.output(PDFDocument.java, Compiled 
Code)
        at org.apache.fop.render.pdf.PDFRenderer.render(PDFRenderer.java, 
Compiled Code)
        at org.apache.fop.apps.StreamRenderer.queuePage(StreamRenderer.java, 
Compiled Code)
        at org.apache.fop.layout.AreaTree.addPage(AreaTree.java, Compiled Code)
        at org.apache.fop.fo.pagination.PageSequence.format(PageSequence.java, 
Compiled Code)
        at org.apache.fop.apps.StreamRenderer.render(StreamRenderer.java, 
Compiled Code)
        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java, 
Compiled Code)
        at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java, 
Compiled Code)
        at 
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java,
 Compiled Code)
        at 
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java,
 Compiled Code)
        at 
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java,
 Compiled Code)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java, Compiled 
Code)
        at org.apache.fop.apps.Driver.render(Driver.java, Compiled Code)
        at org.apache.fop.apps.Driver.run(Driver.java, Compiled Code)
        at MMerge.main(MMerge.java, Compiled Code)


I have tried using both the file: and http: protocols for the src of
the external-graphic, with the same results.

This EPS graphic is in a <static-content> element.  I tried putting it
in <flow> and got the same error.  There are other EPS graphics in the
documents, but they are unique in each document, and do not cause an
error.  (If I comment out the reused EPS, the process runs normally
and produces a sequence of PDF files.)

A JPEG image that is reused (either in <static-content> or <flow>) does
not cause this problem.

The FO streams are well-formed--if I save them as files and then
format them individually, everything works fine.

I have tried using a new Driver object on each iteration, (instead of
resetting and reusing the same one) but that doesn't make any
difference.

It looks like there must be a problem with the Fop code for handling
EPS objects, but I don't understand how any cache could survive a
Driver.reset() operation, and certainly shouldn't affect a completely
new Driver.

I am using fop 0.20.3.

'java -version' yields:
  java version "1.2.2"
  Classic VM (build Linux_JDK_1.2.2_FCS, native threads, sunwjit)

I didn't find a bug report on this.  Should I file one?

Thanks,
--Paul

Reply via email to