You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2001/11/12 21:24:15 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/utils URI.java

sandygao    01/11/12 12:24:15

  Modified:    java/src/org/apache/xerces/utils Tag: xerces_j_1 URI.java
  Log:
  Fixing bug [3375]: allow a valid uri string.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.8.2.1   +16 -10    xml-xerces/java/src/org/apache/xerces/utils/Attic/URI.java
  
  Index: URI.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/utils/Attic/URI.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- URI.java	2001/07/13 17:54:04	1.8
  +++ URI.java	2001/11/12 20:24:15	1.8.2.1
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999,2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999,2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -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.8 2001/07/13 17:54:04 sandygao Exp $
  +* @version  $Id: URI.java,v 1.8.2.1 2001/11/12 20:24:15 sandygao Exp $
   *
   **********************************************************************/
    public class URI implements Serializable {
  @@ -377,15 +377,21 @@
       int uriSpecLen = uriSpec.length();
       int index = 0;
   
  -    // 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(':');
  -    int slashIdx = uriSpec.indexOf('/');
  -    if ((colonIdx < 2) || (colonIdx > slashIdx && slashIdx != -1)) {
  -      int fragmentIdx = uriSpec.indexOf('#');
  +    // Check for scheme, which must be before '/', '?' or '#'. Also handle
  +    // names with DOS drive letters ('D:'), so 1-character schemes are not
  +    // allowed.
  +    int colonIdx    = uriSpec.indexOf(':');
  +    int slashIdx    = uriSpec.indexOf('/');
  +    int queryIdx    = uriSpec.indexOf('?');
  +    int fragmentIdx = uriSpec.indexOf('#');
  +
  +    if ((colonIdx < 2) ||
  +        (colonIdx > slashIdx && slashIdx != -1) ||
  +        (colonIdx > queryIdx && queryIdx != -1) ||
  +        (colonIdx > fragmentIdx && fragmentIdx != -1)) {
         // A standalone base is a valid URI according to spec
  -      if (p_base == null && fragmentIdx != 0 ) {
  -        throw new MalformedURIException("No scheme found in URI.");
  +      if (p_base == null && fragmentIdx != 0) {
  +              throw new MalformedURIException("No scheme found in URI.");
         }
       }
       else {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org