You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@locus.apache.org on 2000/12/20 18:31:26 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/utils URI.java
lehors 00/12/20 09:31:26
Modified: java/src/org/apache/xerces/utils URI.java
Log:
Applied patch from Mark Diekhans:
This fixes a bug were we fail to parse URI's containing DOS &#$! drive
letters correctly.
Revision Changes Path
1.4 +7 -4 xml-xerces/java/src/org/apache/xerces/utils/URI.java
Index: URI.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/utils/URI.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- URI.java 2000/09/12 00:35:14 1.3
+++ URI.java 2000/12/20 17:31:25 1.4
@@ -88,7 +88,7 @@
* default port for a specific scheme). Rather, it only knows the
* grammar and basic set of operations that can be applied to a URI.
*
-* @version $Id: URI.java,v 1.3 2000/09/12 00:35:14 jeffreyr Exp $
+* @version $Id: URI.java,v 1.4 2000/12/20 17:31:25 lehors Exp $
*
**********************************************************************/
public class URI implements Serializable {
@@ -377,10 +377,13 @@
int uriSpecLen = uriSpec.length();
int index = 0;
- // check for scheme
- if (uriSpec.indexOf(':') == -1) {
+ // Check for scheme, which must be before `/'. Also handle names with
+ // DOS drive letters ('D:'), so 1-character schemes are not allowed.
+ int colonIdx = uriSpec.indexOf(':');
+ if ((colonIdx < 2) || (colonIdx > uriSpec.indexOf('/'))) {
int fragmentIdx = uriSpec.indexOf('#');
- if (p_base == null && fragmentIdx != 0 ) {//A standalone base is a valid URI according to spec
+ // A standalone base is a valid URI according to spec
+ if (p_base == null && fragmentIdx != 0 ) {
throw new MalformedURIException("No scheme found in URI.");
}
}