sboag       01/03/11 13:47:47

  Modified:    java/src/org/apache/xml/utils SystemIDResolver.java
  Log:
  Added getAbsoluteURI(String url), and merge
  with Myriam's changes.
  Part of fix for problem found when
  investigating http://nagoya.apache.org/bugzilla/show_bug.cgi?id=906.
  
  Revision  Changes    Path
  1.7       +27 -8     
xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java
  
  Index: SystemIDResolver.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SystemIDResolver.java     2001/03/08 22:48:02     1.6
  +++ SystemIDResolver.java     2001/03/11 21:47:46     1.7
  @@ -90,10 +90,10 @@
   
       if (null != curdir)
       {
  -                     if (uri != null)
  -                             uri = "file:///" + curdir + 
System.getProperty("file.separator") + uri;
  -                     else
  -                             uri = "file:///" + curdir + 
System.getProperty("file.separator");
  +                        if (uri != null)
  +                                uri = "file:///" + curdir + 
System.getProperty("file.separator") + uri;
  +                        else
  +                                uri = "file:///" + curdir + 
System.getProperty("file.separator");
       }
   
       if (null != uri && (uri.indexOf('\\') > -1))
  @@ -101,6 +101,25 @@
   
       return uri;
     }
  +  
  +  /**
  +   * Take a SystemID string and try and turn it into a good absolute URL.
  +   *
  +   * @param urlString url A URL string, which may be relative or absolute.
  +   *
  +   * @return The resolved absolute URI
  +   * @throws TransformerException thrown if the string can't be turned into 
a URL.
  +   */
  +  public static String getAbsoluteURI(String url)
  +          throws TransformerException
  +  {
  +    if (url.indexOf(':') < 0)
  +    {
  +      url = getAbsoluteURIFromRelative(url);
  +    }
  +    return url;
  +  }
  +
   
     /**
      * Take a SystemID string and try and turn it into a good absolute URL.
  @@ -114,9 +133,9 @@
     public static String getAbsoluteURI(String urlString, String base)
             throws TransformerException
     {
  -             boolean isAbsouteUrl = false;
  -             if (urlString.indexOf(':') > 0)
  -                     isAbsouteUrl = true;
  +    boolean isAbsouteUrl = false;
  +    if (urlString.indexOf(':') > 0)
  +            isAbsouteUrl = true;
   
       if ((!isAbsouteUrl) && ((null == base)
               || (base.indexOf(':') < 0)))
  @@ -135,7 +154,7 @@
         else
         {
           urlString = urlString.substring(5);
  -                             isAbsouteUrl = false;
  +                                isAbsouteUrl = false;
         }
       }   
   
  
  
  

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

Reply via email to