Skip to content

Commit

Permalink
Fix #5602.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkocher committed Jan 1, 2011
1 parent 6956c9a commit 3a4301a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 31 deletions.
15 changes: 14 additions & 1 deletion source/ch/cyberduck/core/Path.java
Expand Up @@ -432,7 +432,20 @@ public void invalidate() {
}

@Override
public abstract AttributedList<Path> list();
public AttributedList<Path> list() {
return this.list(new AttributedList<Path>() {
@Override
public boolean add(Path path) {
if(!path.isChild(Path.this)) {
log.warn("Skip adding child to directory listing:" + path);
return false;
}
return super.add(path);
}
});
}

protected abstract AttributedList<Path> list(AttributedList<Path> children);

/**
* Accessability for #getSession.cache()
Expand Down
4 changes: 1 addition & 3 deletions source/ch/cyberduck/core/azure/AzurePath.java
Expand Up @@ -301,10 +301,8 @@ public boolean exists() {
}
}


@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand Down
3 changes: 1 addition & 2 deletions source/ch/cyberduck/core/cf/CFPath.java
Expand Up @@ -210,8 +210,7 @@ public void readTimestamp() {
}

@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand Down
4 changes: 0 additions & 4 deletions source/ch/cyberduck/core/cloud/CloudPath.java
Expand Up @@ -18,7 +18,6 @@
* dkocher@cyberduck.ch
*/

import ch.cyberduck.core.AttributedList;
import ch.cyberduck.core.Local;
import ch.cyberduck.core.Path;
import ch.cyberduck.core.Permission;
Expand Down Expand Up @@ -140,9 +139,6 @@ public void readUnixPermission() {
throw new UnsupportedOperationException();
}

@Override
public abstract AttributedList<Path> list();

@Override
public Set<DescriptiveUrl> getHttpURLs() {
Set<DescriptiveUrl> list = super.getHttpURLs();
Expand Down
7 changes: 1 addition & 6 deletions source/ch/cyberduck/core/dav/DAVPath.java
Expand Up @@ -153,8 +153,7 @@ public void delete() {


@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand All @@ -176,10 +175,6 @@ public AttributedList<Path> list() {
Path p = PathFactory.createPath(this.getSession(), uri.getPath(),
resource.getResourceType().isCollection() ? Path.DIRECTORY_TYPE : Path.FILE_TYPE);
p.setParent(this);
if(!p.isChild(this)) {
log.warn("Skipping invalid resource:" + resource);
continue;
}
p.attributes().setOwner(resource.getOwner());
if(resource.getGetLastModified() > 0) {
p.attributes().setModificationDate(resource.getGetLastModified());
Expand Down
3 changes: 1 addition & 2 deletions source/ch/cyberduck/core/dropbox/DropboxPath.java
Expand Up @@ -101,8 +101,7 @@ public DropboxSession getSession() {
}

@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand Down
3 changes: 1 addition & 2 deletions source/ch/cyberduck/core/ftp/FTPPath.java
Expand Up @@ -164,8 +164,7 @@ else if(this.getSession().getClient().getDataConnectionMode() == FTPClient.ACTIV
}

@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand Down
3 changes: 1 addition & 2 deletions source/ch/cyberduck/core/gdocs/GDPath.java
Expand Up @@ -642,8 +642,7 @@ protected boolean isConversionSupported() {
}

@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand Down
8 changes: 1 addition & 7 deletions source/ch/cyberduck/core/s3/S3Path.java
Expand Up @@ -636,8 +636,7 @@ public void writeRequest(OutputStream out) throws IOException {
}

@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand Down Expand Up @@ -732,11 +731,6 @@ protected AttributedList<Path> listObjects(String bucket, String prefix, String
for(StorageObject object : objects) {
final S3Path p = (S3Path) PathFactory.createPath(this.getSession(), bucket,
object.getKey(), Path.FILE_TYPE);
if(!p.isChild(this)) {
// #Workaround for key that end with /. Refer to #3347.
log.warn("Skipping object " + object.getKey());
continue;
}
p.setParent(this);
p.attributes().setSize(object.getContentLength());
p.attributes().setModificationDate(object.getLastModifiedDate().getTime());
Expand Down
3 changes: 1 addition & 2 deletions source/ch/cyberduck/core/sftp/SFTPPath.java
Expand Up @@ -95,8 +95,7 @@ public SFTPSession getSession() {
}

@Override
public AttributedList<Path> list() {
final AttributedList<Path> children = new AttributedList<Path>();
public AttributedList<Path> list(final AttributedList<Path> children) {
if(this.attributes().isDirectory()) {
try {
this.getSession().check();
Expand Down

0 comments on commit 3a4301a

Please sign in to comment.