Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8126981

Gtk: Line break when get a list of Files from DragEvent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 7u6
    • javafx
    • Testsystem Debain 7 (Linux lunachod 3.2.0-2-686-pae), Java Version 1.7 u6


      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"
                                     }
                             }

            azvegint Alexander Zvegintsev
            amoncsekjfx Andy Moncsek (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: