DnD event on a node with a list of Files. The resulting list of files are all corrupt, because the URL contains a line break. If you try to use the File object you will always get a FileNotFoundExceptipon. The workaround file.toString().replaceAll("(\\r|\\n)", "") solves this issue
Example:
public void handle(final DragEvent event) {
final Dragboard db = event.getDragboard();
String url = null;
if (db.hasFiles()) {
final List<File> myFiles = db.getFiles();
// if you put 3 files from Nautilus, each File in this list is like "/home/xyz/myFile.txt\n"
}
}
- relates to
-
JDK-8124934 Gtk: On Linux Dragboard.getFiles returns a List where File elements have a path ending with a carriage return
-
- Resolved
-