adammurdoch 2003/02/21 05:11:36
Modified: vfs/src/java/org/apache/commons/vfs/provider
BasicFileName.java
Log:
Don't remove the trailing slash from the root uri if it has already been removed.
Revision Changes Path
1.4 +14 -6
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/BasicFileName.java
Index: BasicFileName.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/BasicFileName.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BasicFileName.java 17 Feb 2003 09:22:14 -0000 1.3
+++ BasicFileName.java 21 Feb 2003 13:11:36 -0000 1.4
@@ -71,15 +71,23 @@
public BasicFileName( final String rootUri, final String path )
{
- this( UriParser.extractScheme( rootUri ), rootUri, path );
+ this( UriParser.extractScheme( rootUri ), rootUri, path, false );
}
public BasicFileName( final String scheme,
final String rootUri,
final String path )
{
+ this( scheme, rootUri, path, false );
+ }
+
+ private BasicFileName( final String scheme,
+ final String rootUri,
+ final String path,
+ final boolean normalised )
+ {
super( scheme, path );
- if ( rootUri.endsWith( SEPARATOR ) )
+ if ( !normalised && rootUri.endsWith( SEPARATOR ) )
{
// Remove trailing separator
this.rootUri = rootUri.substring( 0, rootUri.length() - 1 );
@@ -92,12 +100,12 @@
public BasicFileName( final FileName rootUri, final String path )
{
- this( rootUri.getScheme(), rootUri.getURI(), path );
+ this( rootUri.getScheme(), rootUri.getURI(), path, false );
}
public BasicFileName( final URL rootUrl, final String path )
{
- this( rootUrl.getProtocol(), rootUrl.toExternalForm(), path );
+ this( rootUrl.getProtocol(), rootUrl.toExternalForm(), path, false );
}
/**
@@ -105,7 +113,7 @@
*/
protected FileName createName( final String path )
{
- return new BasicFileName( getScheme(), rootUri, path );
+ return new BasicFileName( getScheme(), rootUri, path, true );
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]