commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject svn commit: r170156 - in /jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local: GenericFileNameParser.java LocalFileName.java LocalFileNameParser.java WindowsFileNameParser.java
Date Sat, 14 May 2005 18:52:28 GMT
Author: imario
Date: Sat May 14 11:52:27 2005
New Revision: 170156

URL: http://svn.apache.org/viewcvs?rev=170156&view=rev
Log:
avoid file://// for localfile filenames

PR: 34858
Reported By: Philippe Poulard

Modified:
    jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/GenericFileNameParser.java
    jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileName.java
    jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileNameParser.java
    jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/WindowsFileNameParser.java

Modified: jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/GenericFileNameParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/GenericFileNameParser.java?rev=170156&r1=170155&r2=170156&view=diff
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/GenericFileNameParser.java
(original)
+++ jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/GenericFileNameParser.java
Sat May 14 11:52:27 2005
@@ -16,6 +16,7 @@
 package org.apache.commons.vfs.provider.local;
 
 import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileName;
 
 /**
  * A general-purpose file name parser.
@@ -52,6 +53,17 @@
             throw new FileSystemException("vfs.provider.local/not-absolute-file-name.error",
uri);
         }
 
+        // do not strip the separator, BUT also return it ...
         return "/";
+    }
+
+    /*
+     * ... this is why whe need this:
+     * here the rootFilename can only be "/" (see above) put this "/" is also in the pathname
+     * so its of no value for the LocalFileName instance
+     */
+    protected FileName createFileName(String scheme, final String rootFile, final String
path)
+    {
+        return new LocalFileName(scheme, "", path);
     }
 }

Modified: jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileName.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileName.java?rev=170156&r1=170155&r2=170156&view=diff
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileName.java
(original)
+++ jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileName.java
Sat May 14 11:52:27 2005
@@ -64,5 +64,5 @@
         buffer.append(getScheme());
         buffer.append("://");
         buffer.append(rootFile);
-    } 
+    }
 }

Modified: jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileNameParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileNameParser.java?rev=170156&r1=170155&r2=170156&view=diff
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileNameParser.java
(original)
+++ jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/LocalFileNameParser.java
Sat May 14 11:52:27 2005
@@ -78,6 +78,8 @@
         UriParser.normalisePath(name);
         final String path = name.toString();
 
-        return new LocalFileName(scheme, rootFile, path);
+        return createFileName(scheme, rootFile, path);
     }
+
+    protected abstract FileName createFileName(String scheme, final String rootFile, final
String path);
 }

Modified: jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/WindowsFileNameParser.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/WindowsFileNameParser.java?rev=170156&r1=170155&r2=170156&view=diff
==============================================================================
--- jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/WindowsFileNameParser.java
(original)
+++ jakarta/commons/sandbox/vfs/trunk/src/java/org/apache/commons/vfs/provider/local/WindowsFileNameParser.java
Sat May 14 11:52:27 2005
@@ -16,6 +16,7 @@
 package org.apache.commons.vfs.provider.local;
 
 import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileName;
 
 /**
  * A parser for Windows file names.
@@ -34,6 +35,11 @@
         throws FileSystemException
     {
         return extractWindowsRootPrefix(uri, name);
+    }
+
+    protected FileName createFileName(String scheme, final String rootFile, final String
path)
+    {
+        return new LocalFileName(scheme, rootFile, path);
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message