ASF Bugzilla – Attachment 21575 Details for
Bug 44466
XMLGraphics does not accept SAXSource'd images anymore after the latest image loaders changes [w-patch]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch that detects if source is SAXSource and uses its stream.
xg-commons-use-SAXSource.patch (text/plain), 2.72 KB, created by
Adam Strzelecki
on 2008-02-21 11:10:16 UTC
(
hide
)
Description:
Patch that detects if source is SAXSource and uses its stream.
Filename:
MIME Type:
Creator:
Adam Strzelecki
Created:
2008-02-21 11:10:16 UTC
Size:
2.72 KB
patch
obsolete
>Index: src/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java >=================================================================== >--- src/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java (revision 629877) >+++ src/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java (working copy) >@@ -31,6 +31,8 @@ > import javax.xml.transform.Source; > import javax.xml.transform.dom.DOMSource; > import javax.xml.transform.stream.StreamSource; >+import javax.xml.transform.sax.SAXSource; >+import org.xml.sax.InputSource; > > import org.apache.commons.io.FileUtils; > import org.apache.commons.io.IOUtils; >@@ -68,7 +70,7 @@ > } > return null; > } >- if (!(source instanceof StreamSource)) { >+ if (!(source instanceof StreamSource) && !(source instanceof SAXSource)) { > //Return any non-stream Sources and let the ImageLoaders deal with them > return source; > } >@@ -86,9 +88,16 @@ > if (f != null) { > boolean directFileAccess = true; > InputStream in = null; >- if (source instanceof StreamSource) { >- StreamSource streamSource = (StreamSource)source; >- in = streamSource.getInputStream(); >+ if ((source instanceof StreamSource) || (source instanceof SAXSource)) { >+ if (source instanceof StreamSource) { >+ StreamSource streamSource = (StreamSource)source; >+ in = streamSource.getInputStream(); >+ } else if (source instanceof SAXSource) { >+ InputSource inputSource = ((SAXSource)source).getInputSource(); >+ if(inputSource != null) { >+ in = inputSource.getByteStream(); >+ } >+ } > if (in == null) { > try { > in = new java.io.FileInputStream(f); >@@ -99,6 +108,8 @@ > return null; > } > } >+ } >+ if(in != null) { > in = ImageUtil.decorateMarkSupported(in); > try { > if (ImageUtil.isGZIPCompressed(in)) { >@@ -140,6 +151,12 @@ > } > in = ssrc.getInputStream(); > } >+ if (source instanceof SAXSource) { >+ InputSource inputSource = ((SAXSource)source).getInputSource(); >+ if(inputSource != null) { >+ in = inputSource.getByteStream(); >+ } >+ } > if (in == null && url != null) { > try { > in = url.openStream();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 44466
: 21575