ytalwar 2005/02/22 13:35:41
Modified: java/src/org/apache/xml/utils URI.java
Log:
The fix is for XALANJ-2059.
The problem is that when href attribute has aboslute uri with jar scheme and
base uri is not null, then base uri is pre-appended to uri specified in href
attribute.
The newer patch is according to RFC 2396.
The newer patch ignores base uri and directly make use of uri specifed href
attribute, provided following conditions are met.
a)If uri specified in href attribute starts with / after the scheme and :
For example, href="file:/myDIR/myXSLFile.xsl.
b)If scheme specified for uri href attribute is not same as scheme for base
uri.
c)If base uri is not hierarchical
Henry Zongaro has helped creating this patch.
Revision Changes Path
1.13 +24 -1 xml-xalan/java/src/org/apache/xml/utils/URI.java
Index: URI.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/URI.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- URI.java 17 Aug 2004 18:57:22 -0000 1.12
+++ URI.java 22 Feb 2005 21:35:41 -0000 1.13
@@ -396,6 +396,29 @@
{
initializeScheme(uriSpec);
uriSpec = uriSpec.substring(colonIndex+1);
+ // This is a fix for XALANJ-2059.
+ if(m_scheme != null && p_base != null)
+ {
+ // a) If <uriSpec> starts with a slash (/), it means <uriSpec> is
absolute
+ // and p_base can be ignored.
+ // For example,
+ // uriSpec = file:/myDIR/myXSLFile.xsl
+ // p_base = file:/myWork/
+ //
+ // Here, uriSpec has absolute path after scheme file and :
+ // Hence p_base can be ignored.
+ //
+ // b) Similarily, according to RFC 2396, uri is resolved for
<uriSpec> relative to <p_base>
+ // if scheme in <uriSpec> is same as scheme in <p_base>, else
p_base can be ignored.
+ //
+ // c) if <p_base> is not hierarchical, it can be ignored.
+ //
+ if(uriSpec.startsWith("/") || !m_scheme.equals(p_base.m_scheme) ||
!p_base.getSchemeSpecificPart().startsWith("/"))
+ {
+ p_base = null;
+ }
+ }
+ // Fix for XALANJ-2059
uriSpecLen = uriSpec.length();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]