1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-25 01:08:52 -05:00

* don't crash just because if there's something wrong with GVFS

This commit is contained in:
Reinhard Pointner 2012-11-24 06:27:24 +00:00
parent a5ed0351d1
commit 21fa1a19c4

View File

@ -122,19 +122,23 @@ public class FileTransferable implements Transferable {
file = new File(uri); file = new File(uri);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// try handle other GVFS URI schemes // try handle other GVFS URI schemes
try {
if (GVFS.isSupported()) { if (GVFS.isSupported()) {
file = GVFS.getPathForURI(uri); file = GVFS.getPathForURI(uri);
} }
} catch (LinkageError error) {
Logger.getLogger(FileTransferable.class.getName()).log(Level.WARNING, "Unable to resolve GVFS URI", e);
}
} }
if (!file.exists()) { if (file == null || !file.exists()) {
throw new FileNotFoundException(file.toString()); throw new FileNotFoundException(line);
} }
files.add(file); files.add(file);
} catch (Throwable e) { } catch (Throwable e) {
// URISyntaxException, IllegalArgumentException, FileNotFoundException, LinkageError, etc // URISyntaxException, IllegalArgumentException, FileNotFoundException, LinkageError, etc
Logger.getLogger(FileTransferable.class.getName()).log(Level.WARNING, "Invalid file URI: " + line, e); Logger.getLogger(FileTransferable.class.getName()).log(Level.WARNING, "Invalid file URI: " + line);
} }
return files; return files;
} }