craigmcc    00/11/04 21:28:53

  Modified:    src/share/org/apache/tomcat/util Tag: tomcat_32
                        FileUtil.java
  Log:
  Update pathname parsing to deal with multiple '\' characters on NetWare
  platforms.
  
  Submitted by: Mike Anderson <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.9.2.5   +15 -7     jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java
  
  Index: FileUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v
  retrieving revision 1.9.2.4
  retrieving revision 1.9.2.5
  diff -u -r1.9.2.4 -r1.9.2.5
  --- FileUtil.java     2000/10/11 00:24:45     1.9.2.4
  +++ FileUtil.java     2000/11/05 05:28:53     1.9.2.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.9.2.4 
2000/10/11 00:24:45 arieh Exp $
  - * $Revision: 1.9.2.4 $
  - * $Date: 2000/10/11 00:24:45 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v 1.9.2.5 
2000/11/05 05:28:53 craigmcc Exp $
  + * $Revision: 1.9.2.5 $
  + * $Date: 2000/11/05 05:28:53 $
    *
    * ====================================================================
    *
  @@ -267,12 +267,20 @@
            patchPath = sb.toString();
        }
   
  -     // fix path on NetWare
  +     // fix path on NetWare - all '/' become '\\' and remove duplicate '\\'
        if (System.getProperty("os.name").startsWith("NetWare") &&
            path.length() >=3 &&
  -         path.indexOf(':') > 0)
  -         patchPath = patchPath.replace('/', '\\');
  -
  +         path.indexOf(':') > 0) {
  +            char ca[] = patchPath.replace('/', '\\').toCharArray();
  +            StringBuffer sb = new StringBuffer();
  +            for (int i = 0; i < ca.length; i++) {
  +                if ((ca[i] != '\\') ||
  +                    (ca[i] == '\\' && i > 0 && ca[i-1] != '\\')) {
  +                    sb.append(ca[i]);
  +                }
  +            }
  +            patchPath = sb.toString();
  +        }
        return patchPath;
       }
   
  
  
  

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

Reply via email to