ASF Bugzilla – Attachment 22771 Details for
Bug 46048
Wrong images used (how to clear image cache?)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch against FOP Trunk for URI pre-resolution
uri-preresolution-proposal.patch (text/plain), 2.65 KB, created by
Jeremias Maerki
on 2008-10-23 04:48:08 UTC
(
hide
)
Description:
Proposed patch against FOP Trunk for URI pre-resolution
Filename:
MIME Type:
Creator:
Jeremias Maerki
Created:
2008-10-23 04:48:08 UTC
Size:
2.65 KB
patch
obsolete
>Index: src/java/org/apache/fop/datatypes/URISpecification.java >=================================================================== >--- src/java/org/apache/fop/datatypes/URISpecification.java (revision 707345) >+++ src/java/org/apache/fop/datatypes/URISpecification.java (working copy) >@@ -20,6 +20,8 @@ > package org.apache.fop.datatypes; > > import java.io.UnsupportedEncodingException; >+import java.net.URI; >+import java.net.URISyntaxException; > > > /** >@@ -138,4 +140,26 @@ > return sb.toString(); > } > >+ /** >+ * Performs URI resolution (as described in {@code java.net.URI}'s Javadocs) relative to >+ * an optional base URI. Note: this is not the same as URI resolution with a JAXP >+ * {@code URIResolver}! >+ * @param uri the URI to resolve >+ * @param base the base URI or null >+ * @return the effective absolute URI >+ */ >+ public static String preResolveURI(String uri, String base) { >+ if (base != null && base.length() > 0) { >+ URI baseURI; >+ try { >+ baseURI = new URI(base); >+ URI effURI = baseURI.resolve(new URI(uri)); >+ return effURI.toString(); >+ } catch (URISyntaxException e) { >+ //ignore, just return original URI >+ } >+ } >+ return uri; >+ } >+ > } >Index: src/java/org/apache/fop/fo/flow/ExternalGraphic.java >=================================================================== >--- src/java/org/apache/fop/fo/flow/ExternalGraphic.java (revision 707345) >+++ src/java/org/apache/fop/fo/flow/ExternalGraphic.java (working copy) >@@ -73,8 +73,9 @@ > src = pList.get(PR_SRC).getString(); > > //Additional processing: obtain the image's intrinsic size and baseline information >+ FOUserAgent userAgent = getUserAgent(); > url = URISpecification.getURL(src); >- FOUserAgent userAgent = getUserAgent(); >+ url = URISpecification.preResolveURI(url, userAgent.getBaseURL()); > ImageManager manager = userAgent.getFactory().getImageManager(); > ImageInfo info = null; > try { >Index: src/java/org/apache/fop/render/pdf/PDFRenderer.java >=================================================================== >--- src/java/org/apache/fop/render/pdf/PDFRenderer.java (revision 707345) >+++ src/java/org/apache/fop/render/pdf/PDFRenderer.java (working copy) >@@ -1633,6 +1633,7 @@ > (int)pos.getHeight()); > > uri = URISpecification.getURL(uri); >+ uri = URISpecification.preResolveURI(uri, userAgent.getBaseURL()); > PDFXObject xobject = pdfDoc.getXObject(uri); > if (xobject != null) { > float w = (float) pos.getWidth() / 1000f;
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 46048
: 22771