xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mrgla...@apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/util URI.java
Date Tue, 21 Sep 2004 21:10:23 GMT
mrglavas    2004/09/21 14:10:23

  Modified:    java/src/org/apache/xerces/util URI.java
  Log:
  Some additional changes for new initialization and absolutize methods.
  
  Revision  Changes    Path
  1.21      +21 -13    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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- URI.java	16 Sep 2004 04:29:28 -0000	1.20
  +++ URI.java	21 Sep 2004 21:10:23 -0000	1.21
  @@ -284,14 +284,14 @@
      * 
      * @param p_uriSpec the URI specification string (cannot be null or
      *                  empty)
  -   * @param allowRelativeURI true to set up not throwing an exception 
  -   *                      in case of relative URI, false otherwise.
  +   * @param allowNonAbsoluteURI true to permit non-absolute URIs, 
  +   *                            false otherwise.
      *
      * @exception MalformedURIException if p_uriSpec violates any syntax
      *                                   rules
      */
  -  public URI(String p_uriSpec, boolean allowRelativeURI) throws MalformedURIException {
  -      this((URI)null, p_uriSpec, allowRelativeURI);
  +  public URI(String p_uriSpec, boolean allowNonAbsoluteURI) throws MalformedURIException
{
  +      this((URI)null, p_uriSpec, allowNonAbsoluteURI);
     }
     
    /**
  @@ -321,14 +321,14 @@
      *               empty)
      * @param p_uriSpec the URI specification string (cannot be null or
      *                  empty if p_base is null)
  -   * @param allowRelativeURI true to set up not throwing an exception 
  -   *                      in case of relative URI, false otherwise.
  +   * @param allowNonAbsoluteURI true to permit non-absolute URIs, 
  +   *                            false otherwise.
      *
      * @exception MalformedURIException if p_uriSpec violates any syntax
      *                                  rules
      */
  -  public URI(URI p_base, String p_uriSpec, boolean allowRelativeURI) throws MalformedURIException
{
  -      initialize(p_base, p_uriSpec, allowRelativeURI);
  +  public URI(URI p_base, String p_uriSpec, boolean allowNonAbsoluteURI) throws MalformedURIException
{
  +      initialize(p_base, p_uriSpec, allowNonAbsoluteURI);
     }
   
    /**
  @@ -477,20 +477,24 @@
      * @param p_uriSpec the URI spec string which may be an absolute or
      *                  relative URI (can only be null/empty if p_base
      *                  is not null)
  -   * @param allowRelativeURI true to set up not throwing an exception 
  +   * @param allowNonAbsoluteURI true to permit non-absolute URIs, 
      *                         in case of relative URI, false otherwise.
      *
      * @exception MalformedURIException if p_base is null and p_uriSpec
      *                                  is not an absolute URI or if
      *                                  p_uriSpec violates syntax rules
      */
  -  private void initialize(URI p_base, String p_uriSpec, boolean allowRelativeURI)
  +  private void initialize(URI p_base, String p_uriSpec, boolean allowNonAbsoluteURI)
         throws MalformedURIException {
         
         String uriSpec = p_uriSpec;
         int uriSpecLen = (uriSpec != null) ? uriSpec.length() : 0;
         
         if (p_base == null && uriSpecLen == 0) {
  +          if (allowNonAbsoluteURI) {
  +              m_path = "";
  +              return;
  +          }
             throw new MalformedURIException("Cannot initialize URI with empty parameters.");
         }
         
  @@ -516,7 +520,7 @@
             if (colonIdx < 2 || slashIdx != -1 || 
                 queryIdx != -1 || fragmentIdx != -1) {
                 // A standalone base is a valid URI according to spec
  -              if (colonIdx == 0 || (p_base == null && fragmentIdx != 0 &&
!allowRelativeURI)) {
  +              if (colonIdx == 0 || (p_base == null && fragmentIdx != 0 &&
!allowNonAbsoluteURI)) {
                     throw new MalformedURIException("No scheme found in URI.");
                 }
             }
  @@ -530,7 +534,7 @@
                 }
             }
         }
  -      else if (p_base == null && uriSpec.indexOf('#') != 0 && !allowRelativeURI)
{
  +      else if (p_base == null && uriSpec.indexOf('#') != 0 && !allowNonAbsoluteURI)
{
             throw new MalformedURIException("No scheme found in URI.");    
         }
         
  @@ -728,6 +732,10 @@
             
             if (m_queryString == null) {
                 m_queryString = p_base.getQueryString();
  +              
  +              if (m_fragment == null) {
  +                  m_fragment = p_base.getFragment();
  +              }
             }
             return;
         }
  
  
  

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


Mime
View raw message