You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2004/05/25 16:43:02 UTC
cvs commit: jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp FtpFileObject.java
imario 2004/05/25 07:43:01
Modified: vfs/src/java/org/apache/commons/vfs/provider/ftp
FtpFileObject.java
Log:
PR: 29195
Do not issue a "list ." on the ftp-server as this might in certain (rare) cases (e.g. uu.net) force the server to do this recursive!!
in this case (".") now we issue a "list /" which means in this context the same.
Revision Changes Path
1.24 +23 -5 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java
Index: FtpFileObject.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileObject.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- FtpFileObject.java 10 May 2004 20:09:49 -0000 1.23
+++ FtpFileObject.java 25 May 2004 14:43:01 -0000 1.24
@@ -1,12 +1,12 @@
/*
* Copyright 2002, 2003,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -58,7 +58,17 @@
{
super(name, fileSystem);
ftpFs = fileSystem;
- relPath = rootName.getRelativeName(name);
+ String relPath = rootName.getRelativeName(name);
+ if (".".equals(relPath))
+ {
+ // do not use the "." as path against the ftp-server
+ // e.g. the uu.net ftp-server do a recursive listing then
+ this.relPath = rootName.getPath();
+ }
+ else
+ {
+ this.relPath = relPath;
+ }
}
/**
@@ -328,7 +338,15 @@
*/
protected long doGetLastModifiedTime() throws Exception
{
- return (fileInfo.getTimestamp().getTime().getTime());
+ Calendar timestamp = fileInfo.getTimestamp();
+ if (timestamp == null)
+ {
+ return 0L;
+ }
+ else
+ {
+ return (timestamp.getTime().getTime());
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org