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:57:01 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/util URI.java
lehors 00/12/20 09:57:00
Modified: java/src/org/apache/xerces/util Tag: xerces_j_2 URI.java
Log:
Because utils was renamed util on this branch CVS merge doesn't
work... GRrrr! This is a copy of a newer version (1.4) from the main branch.
Revision Changes Path
No revision
No revision
1.1.2.2 +9 -5 xml-xerces/java/src/org/apache/xerces/util/Attic/URI.java
Index: URI.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/Attic/URI.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- URI.java 2000/10/05 01:59:28 1.1.2.1
+++ URI.java 2000/12/20 17:56:58 1.1.2.2
@@ -88,10 +88,10 @@
* 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.1.2.1 2000/10/05 01:59:28 andyc Exp $
+* @version $Id: URI.java,v 1.1.2.2 2000/12/20 17:56:58 lehors Exp $
*
**********************************************************************/
-public class URI implements Serializable {
+ public class URI implements Serializable {
/*******************************************************************
* MalformedURIExceptions are thrown in the process of building a URI
@@ -377,9 +377,13 @@
int uriSpecLen = uriSpec.length();
int index = 0;
- // check for scheme
- if (uriSpec.indexOf(':') == -1) {
- if (p_base == null) {
+ // 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('#');
+ // A standalone base is a valid URI according to spec
+ if (p_base == null && fragmentIdx != 0 ) {
throw new MalformedURIException("No scheme found in URI.");
}
}