Radu Coravu created XGC-92:
------------------------------
Summary: Cannot load SVGZ files when the
URLConnection.getInputStream does not return directly a buffered input stream
Key: XGC-92
URL: https://issues.apache.org/jira/browse/XGC-92
Project: XMLGraphicsCommons
Issue Type: Bug
Components: general
Reporter: Radu Coravu
Fix For: 1.4
I'm running Apache FOP to embed a SVGZ in a PDF document.
The process which runs FOP has its own URLHandler implementation of the "file"
URL protocol which on the method "getInputStream" returns directly the
FileInputStream. (The SUN implementation of FileURLConnection returns a
BufferedInputStream over the FileInputStream).
The Input Stream is not properly re-used in
org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext
leading to the fact that after the first two bytes are read and the image is
determined as SVGZ, the image source remains with the original input stream.
The method AbstractImageSessionContext.newSource(String)
has at some point an IF like:
{code}
if (directFileAccess) {
.....
}
{code}
there should also be an else branch on that IF clause containing:
{code} } else {
if(source instanceof StreamSource &&
ImageUtil.hasInputStream(source)){
((StreamSource)source).setInputStream(in);
}
}{code}
because that "in" variable has been already read and reset by the code above
while the stream source will still contain the original FileInputStream from
which the bytes have been read and which cannot be reset anymore.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]