chrisg 2002/12/08 16:58:47 Modified: . Tag: fop-0_20_2-maintain CHANGES src/org/apache/fop/image Tag: fop-0_20_2-maintain FopImageFactory.java Log: Fixed resolution of relative URLs in FopImageFactory with IBM JDK PR: 14949 Submitted by: Manuel Mall <[EMAIL PROTECTED]> Revision Changes Path No revision No revision 1.10.2.36 +2 -0 xml-fop/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/xml-fop/CHANGES,v retrieving revision 1.10.2.35 retrieving revision 1.10.2.36 diff -u -r1.10.2.35 -r1.10.2.36 --- CHANGES 29 Nov 2002 09:46:18 -0000 1.10.2.35 +++ CHANGES 9 Dec 2002 00:58:47 -0000 1.10.2.36 @@ -1,5 +1,7 @@ ============================================================================== Done since 0.20.4 release +- Fixed resolution of relative URLs in FopImageFactory with IBM JDK + Submitted by: Manuel Mall <[EMAIL PROTECTED]> (see bug #14948) - Fixed infinite loop when page-height="auto" (Oleg Tkachenko) - Fix embedding of Adobe Type 1 fonts. PFB file encoded in PC format were not decoded prior to embedding. This may explain error messages with No revision No revision 1.25.2.8 +26 -3 xml-fop/src/org/apache/fop/image/Attic/FopImageFactory.java Index: FopImageFactory.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/image/Attic/FopImageFactory.java,v retrieving revision 1.25.2.7 retrieving revision 1.25.2.8 diff -u -r1.25.2.7 -r1.25.2.8 --- FopImageFactory.java 24 Nov 2002 21:35:14 -0000 1.25.2.7 +++ FopImageFactory.java 9 Dec 2002 00:58:47 -0000 1.25.2.8 @@ -97,9 +97,32 @@ } try { - absoluteURL = new URL(baseURL, absoluteURL.getFile()); + /* + This piece of code is based on the following statement in RFC2396 section 5.2: + + 3) If the scheme component is defined, indicating that the reference + starts with a scheme name, then the reference is interpreted as an + absolute URI and we are done. Otherwise, the reference URI's + scheme is inherited from the base URI's scheme component. + + Due to a loophole in prior specifications [RFC1630], some parsers + allow the scheme name to be present in a relative URI if it is the + same as the base URI scheme. Unfortunately, this can conflict + with the correct parsing of non-hierarchical URI. For backwards + compatibility, an implementation may work around such references + by removing the scheme if it matches that of the base URI and the + scheme is known to always use the <hier_part> syntax. + + The URL class does not implement this work around, so we do. + */ + + String scheme = baseURL.getProtocol() + ":"; + if (href.startsWith(scheme)) { + href = href.substring(scheme.length()); + } + absoluteURL = new URL(baseURL, href); + System.out.println("baseURL=" + baseURL.toString() + " href=" + href + " absoluteURL=" + absoluteURL.toString()); } catch (MalformedURLException e_context) { - // pb context url throw new FopImageException("Invalid Image URL - error on relative URL : " + e_context.getMessage()); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]