[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] apache fop report - encoded string too long


Subject: [xsl] apache fop report - encoded string too long
From: "Johnston, Scott" <Scott.Johnston@xxxxxxxxxxxxxx>
Date: Mon, 29 Sep 2008 09:57:20 -0700

Hi,

We are upgrading an application from Java 1.4 to 1.5 that uses FOP (and
subsequently an XSL transform).  In the upgrade, the FOP report fails
with the following stack trace:

java.io.UTFDataFormatException: encoded string too long: 81879 bytes
            at
java.io.DataOutputStream.writeUTF(DataOutputStream.java:347)
            at
java.io.DataOutputStream.writeUTF(DataOutputStream.java:306)
            at
com.sun.org.apache.bcel.internal.classfile.ConstantUtf8.dump(ConstantUtf
8.java:121)
            at
com.sun.org.apache.bcel.internal.classfile.ConstantPool.dump(ConstantPoo
l.java:226)
            at
com.sun.org.apache.bcel.internal.classfile.JavaClass.dump(JavaClass.java
:303)
            at
com.sun.org.apache.bcel.internal.classfile.JavaClass.dump(JavaClass.java
:288)
            at
com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.dumpClass(XSLTC.j
ava:766)
            at
com.sun.org.apache.xalan.internal.xsltc.compiler.Stylesheet.translate(St
ylesheet.java:735)
            at
com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.jav
a:354)
            at
com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC.compile(XSLTC.jav
a:429)
            at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newT
emplates(TransformerFactoryImpl.java:796)
            at
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newT
ransformer(TransformerFactoryImpl.java:623)

This report works fine in 1.4, but not in 1.5.

The code that we've written looks like this:

            // Setup XSLT
            TransformerFactory factory =
TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer(new
StreamSource(xslIn));

Where xslIn is a JarURLInputStream, since the XSL file is included in
the JAR.  Our first thought was to use a BufferedInputStream like this:

            // Setup XSLT
            BufferedInputStream bis = new
BufferedInputStream(xslIn,1000);
            TransformerFactory factory =
TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer(new
StreamSource(bis));


But this doesn't solve the problem at all.  The bigger issue that we
probably have is that the XSL file doesn't need to be this big.  The
reason for it is that we have embedded images in the XSL file, since FOP
works better this way.  So because of this, our XSL file is 1.5mb.


Has anyone else seen this problem in an upgrade from Java 1.4 to 1.5?

Thanks,

-Scott


Current Thread
Keywords