Improved GVFS error logging: GVFS: %s => %s

This commit is contained in:
Reinhard Pointner 2017-02-25 16:03:05 +08:00
parent d2df8d8923
commit c97057b197
1 changed files with 22 additions and 22 deletions

View File

@ -7,7 +7,6 @@ import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.nio.CharBuffer;
@ -93,6 +92,7 @@ public class FileTransferable implements Transferable {
if (useGVFS()) {
if (tr.isDataFlavorSupported(FileTransferable.uriListFlavor)) {
// file URI list flavor (Linux)
try {
Readable transferData = (Readable) tr.getTransferData(FileTransferable.uriListFlavor);
try (Scanner scanner = new Scanner(transferData)) {
@ -106,21 +106,21 @@ public class FileTransferable implements Transferable {
continue;
}
try {
File file = GVFS.getDefaultVFS().getPathForURI(new URI(line));
if (file == null || !file.exists()) {
throw new FileNotFoundException(line);
if (file != null && file.exists()) {
files.add(file);
} else {
debug.warning(format("GVFS: %s => %s", line, file));
}
files.add(file);
} catch (Throwable e) {
debug.warning(e::toString);
}
}
return files;
}
} catch (Throwable e) {
debug.warning(cause(e));
}
}
}