mrglavas    2004/11/17 11:04:50

  Modified:    java/src/org/apache/xerces/util URI.java
  Log:
  Fixing JIRA Bug #701:
  http://nagoya.apache.org/jira/browse/XERCESJ-701
  
  RFC 2396 allows one character schema names. They were being rejected.
  This behaviour was there to help flag DOS file names, but it makes it
  impossible for users who literally mean to specify URIs with one character
  scheme names. To maintain backwards compatibility will update
  XMLEntityManager.expandSystemId so that it catches such URIs when
  strict mode is off. This is the only context where we attempt to fix URIs.
  
  Revision  Changes    Path
  1.22      +5 -9      xml-xerces/java/src/org/apache/xerces/util/URI.java
  
  Index: URI.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/URI.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- URI.java  21 Sep 2004 21:10:23 -0000      1.21
  +++ URI.java  17 Nov 2004 19:04:50 -0000      1.22
  @@ -506,9 +506,7 @@
         
         int index = 0;
         
  -      // Check for scheme, which must be before '/', '?' or '#'. Also handle
  -      // names with DOS drive letters ('D:'), so 1-character schemes are not
  -      // allowed.
  +      // Check for scheme, which must be before '/', '?' or '#'.
         int colonIdx = uriSpec.indexOf(':');
         if (colonIdx != -1) {
             final int searchFrom = colonIdx - 1;
  @@ -517,7 +515,7 @@
             int queryIdx = uriSpec.lastIndexOf('?', searchFrom);
             int fragmentIdx = uriSpec.lastIndexOf('#', searchFrom);
             
  -          if (colonIdx < 2 || slashIdx != -1 || 
  +          if (colonIdx == 0 || slashIdx != -1 || 
                 queryIdx != -1 || fragmentIdx != -1) {
                 // A standalone base is a valid URI according to spec
                 if (colonIdx == 0 || (p_base == null && fragmentIdx != 0 && 
!allowNonAbsoluteURI)) {
  @@ -624,9 +622,7 @@
   
       int index = 0;
   
  -    // Check for scheme, which must be before '/', '?' or '#'. Also handle
  -    // names with DOS drive letters ('D:'), so 1-character schemes are not
  -    // allowed.
  +    // Check for scheme, which must be before '/', '?' or '#'.
       int colonIdx = uriSpec.indexOf(':');
       if (colonIdx != -1) {
           final int searchFrom = colonIdx - 1;
  @@ -635,7 +631,7 @@
           int queryIdx = uriSpec.lastIndexOf('?', searchFrom);
           int fragmentIdx = uriSpec.lastIndexOf('#', searchFrom);
          
  -        if (colonIdx < 2 || slashIdx != -1 || 
  +        if (colonIdx == 0 || slashIdx != -1 || 
               queryIdx != -1 || fragmentIdx != -1) {
               // A standalone base is a valid URI according to spec
               if (colonIdx == 0 || (p_base == null && fragmentIdx != 0)) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to