From e8b6dcb573f893395ae10346fa3d6f619c96e732 Mon Sep 17 00:00:00 2001 From: Keiron Liddle Date: Fri, 7 Sep 2001 13:56:23 +0000 Subject: handles uri's with "url(" + URI + ")" spec is ambigous about what a is git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194455 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/image/FopImageFactory.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/org/apache/fop/image') diff --git a/src/org/apache/fop/image/FopImageFactory.java b/src/org/apache/fop/image/FopImageFactory.java index 7255ca011..8e81761bf 100644 --- a/src/org/apache/fop/image/FopImageFactory.java +++ b/src/org/apache/fop/image/FopImageFactory.java @@ -17,7 +17,6 @@ import java.lang.reflect.Constructor; import java.util.Hashtable; // FOP -import org.apache.fop.messaging.MessageHandler; import org.apache.fop.image.analyser.ImageReaderFactory; import org.apache.fop.image.analyser.ImageReader; import org.apache.fop.configuration.Configuration; @@ -40,10 +39,25 @@ public class FopImageFactory { public static FopImage Make(String href) throws MalformedURLException, FopImageException { + /* + * According to section 5.11 a is: + * "url(" + URI + ")" + * according to 7.28.7 a is: + * URI + * So handle both. + */ // Get the absolute URL URL absoluteURL = null; InputStream imgIS = null; + href = href.trim(); + if(href.startsWith("url(") && (href.indexOf(")") != -1)) { + href = href.substring(4, href.indexOf(")")).trim(); + } try { + // try url as complete first, this can cause + // a problem with relative uri's if there is an + // image relative to where fop is run and relative + // to the base dir of the document try { absoluteURL = new URL(href); } catch (MalformedURLException mue) { -- cgit v1.2.3