* account for weird data

This commit is contained in:
Reinhard Pointner 2012-12-06 17:47:39 +00:00
parent ee6330a10c
commit f73a07a06b
2 changed files with 13 additions and 13 deletions

View File

@ -21,18 +21,18 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<Abstra
private final FileTree tree;
public FileTreeTransferablePolicy(FileTree tree) {
this.tree = tree;
}
@Override
protected boolean accept(List<File> files) {
return true;
}
@Override
protected void clear() {
super.clear();
@ -40,7 +40,7 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<Abstra
tree.clear();
}
@Override
protected void process(List<AbstractTreeNode> chunks) {
FolderNode root = tree.getRoot();
@ -52,13 +52,13 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<Abstra
tree.getModel().reload();
}
@Override
protected void process(Exception e) {
UILogger.log(Level.WARNING, ExceptionUtilities.getRootCauseMessage(e), e);
}
@Override
protected void load(List<File> files) {
try {
@ -74,14 +74,13 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<Abstra
}
}
private AbstractTreeNode getTreeNode(File file) throws InterruptedException {
if (Thread.interrupted())
throw new InterruptedException();
if (file.isDirectory()) {
File[] files = file.listFiles();
File[] files = file.listFiles();
if (files != null && file.isDirectory()) {
FolderNode node = new FolderNode(FileUtilities.getFolderName(file), files.length);
// add folders first
@ -103,7 +102,7 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<Abstra
return new FileNode(file);
}
@Override
public String getFileFilterDescription() {
return "files and folders";

View File

@ -46,12 +46,13 @@ public class FastFile extends File {
@Override
public File[] listFiles() {
String[] names = list();
File[] files = new File[names.length];
if (names == null)
return null;
File[] files = new File[names.length];
for (int i = 0; i < names.length; i++) {
files[i] = new FastFile(this, names[i]);
}
return files;
}