You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by ig...@apache.org on 2003/09/03 21:21:51 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/utils SystemIDResolver.java

igorh       2003/09/03 12:21:51

  Modified:    java/src/org/apache/xml/utils SystemIDResolver.java
  Log:
  Patch for Bugzilla Bug 22777
  
  Revision  Changes    Path
  1.22      +25 -4     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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SystemIDResolver.java	8 Aug 2003 17:11:31 -0000	1.21
  +++ SystemIDResolver.java	3 Sep 2003 19:21:51 -0000	1.22
  @@ -147,8 +147,16 @@
         * character cannot be used as the first segment of a relative URI path
         * (e.g., "this:that"), because it would be mistaken for a scheme name.
        **/
  -     /** %REVIEW% Can we assume here that systemId is a valid URI?
  +     /** 
  +      * %REVIEW% Can we assume here that systemId is a valid URI?
  +      * It looks like we cannot ( See discussion of this common problem in 
  +      * Bugzilla Bug 22777 ). 
        **/
  +     //"fix" for Bugzilla Bug 22777
  +    if(isWindowsAbsolutePath(systemId)){
  +        return false;
  +     }
  +    
       final int fragmentIndex = systemId.indexOf('#');
       final int queryIndex = systemId.indexOf('?');
       final int slashIndex = systemId.indexOf('/');
  @@ -175,10 +183,23 @@
      */
     public static boolean isAbsolutePath(String systemId)
     {
  -    // On Unix, an absolute path starts with '/'.
  -    if (systemId.startsWith(File.separator))
  -      return true;
  +    if(systemId == null)
  +        return false;
  +    final File file = new File(systemId);
  +    return file.isAbsolute();
       
  +  }
  +  
  +   /**
  +   * Return true if the local path is a Windows absolute path.
  +   *
  +   * @param systemId The path string
  +   * @return true if the path is a Windows absolute path
  +   */
  +    private static boolean isWindowsAbsolutePath(String systemId)
  +  {
  +    if(!isAbsolutePath(systemId))
  +      return false;
       // On Windows, an absolute path starts with "[drive_letter]:\".
       if (systemId.length() > 2 
           && systemId.charAt(1) == ':'
  
  
  

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