You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by ig...@apache.org on 2003/08/08 19:11:31 UTC
cvs commit: xml-xalan/java/src/org/apache/xml/utils SystemIDResolver.java
igorh 2003/08/08 10:11:31
Modified: java/src/org/apache/xml/utils SystemIDResolver.java
Log:
Patch for Bugzilla Bug 21893
Revision Changes Path
1.21 +25 -9 xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java
Index: SystemIDResolver.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- SystemIDResolver.java 30 Jan 2003 18:46:19 -0000 1.20
+++ SystemIDResolver.java 8 Aug 2003 17:11:31 -0000 1.21
@@ -135,20 +135,36 @@
}
/**
- * Return true if the systemId denotes an absolute URI (contains the scheme part).
+ * Return true if the systemId denotes an absolute URI .
*
* @param systemId The systemId string
- * @return true if the systemId contains a scheme part
+ * @return true if the systemId is an an absolute URI
*/
public static boolean isAbsoluteURI(String systemId)
{
- // If there is more than one character before the ':' character,
- // then it is considered to be an absolute URI; otherwise it is a local path.
- int colonIndex = systemId.indexOf(':');
- if (colonIndex > 1)
- return true;
- else
- return false;
+ /** http://www.ietf.org/rfc/rfc2396.txt
+ * Authors should be aware that a path segment which contains a colon
+ * character cannot be used as the first segment of a relative URI path
+ * (e.g., "this:that"), because it would be mistaken for a scheme name.
+ **/
+ /** %REVIEW% Can we assume here that systemId is a valid URI?
+ **/
+ final int fragmentIndex = systemId.indexOf('#');
+ final int queryIndex = systemId.indexOf('?');
+ final int slashIndex = systemId.indexOf('/');
+ final int colonIndex = systemId.indexOf(':');
+
+ //finding substring before '#', '?', and '/'
+ int index = systemId.length() -1;
+ if(fragmentIndex > 0)
+ index = fragmentIndex;
+ if((queryIndex > 0) && (queryIndex <index))
+ index = queryIndex;
+ if((slashIndex > 0) && (slashIndex <index))
+ index = slashIndex;
+ // return true if there is ':' before '#', '?', and '/'
+ return ((colonIndex >0) && (colonIndex<index));
+
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org