Hi

In short, I've attached a patch with a workaround.
I've to test it in other environments (windows) before send it to
upstream.
I've to test too the jdk7 / pcmanfm bug and open a new bug.



The root error is pcmanfm sends a null-terminated-string for file list
(nautilus don't send it)

When josm receives a drop, it parses the data calling:

tr.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor);


Then, after some work, it goes to sun.awt.X11.XDataTransferer  line ~287

        while ((line = reader.readLine()) != null) {
                try {
                    uri = new URI(line); //  <-- fails here 
                } catch (URISyntaxException uriSyntaxException) {
                    throw new IOException(uriSyntaxException);  
                }
                uriList.add(uri);
            }

and fails because it tries to make a URI with '\0', 




josm has two methods for processing drop data, the first is failing, the
seconds works. 
The only thing attached patch does is to remove the first method.


Description: Fix Drag and Drop
Fix Drag and Drop from PCManFM (and maybe others)


Origin: other
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/664205
Forwarded: no
Last-Update: 2012-12-14

--- josm-0.0.svn5576+dfsg1.orig/src/org/openstreetmap/josm/gui/FileDrop.java
+++ josm-0.0.svn5576+dfsg1/src/org/openstreetmap/josm/gui/FileDrop.java
@@ -309,31 +309,7 @@ public class FileDrop
             {   // Get whatever was dropped
                 java.awt.datatransfer.Transferable tr = evt.getTransferable();
 
-                // Is it a file list?
-                if (tr.isDataFlavorSupported (java.awt.datatransfer.DataFlavor.javaFileListFlavor))
-                {
-                    // Say we'll take it.
-                    //evt.acceptDrop ( java.awt.dnd.DnDConstants.ACTION_COPY_OR_MOVE );
-                    evt.acceptDrop ( java.awt.dnd.DnDConstants.ACTION_COPY );
-                    log( out, "FileDrop: file list accepted." );
-
-                    // Get a useful list
-                    List<?> fileList = (List<?>)tr.getTransferData(java.awt.datatransfer.DataFlavor.javaFileListFlavor);
-
-                    // Convert list to array
-                    final File[] files = fileList.toArray(new File[fileList.size()]);
-
-                    // Alert listener to drop.
-                    if( listener != null ) {
-                        listener.filesDropped( files );
-                    }
 
-                    // Mark that drop is completed.
-                    evt.getDropTargetContext().dropComplete(true);
-                    log( out, "FileDrop: drop complete." );
-                }   // end if: file list
-                else // this section will check for a reader flavor.
-                {
                     // Thanks, Nathan!
                     // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
                     DataFlavor[] flavors = tr.getTransferDataFlavors();
@@ -365,7 +341,7 @@ public class FileDrop
                         evt.rejectDrop();
                     }
                     // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
-                }   // end else: not a file list
+
             }   // end try
             catch ( java.io.IOException io)
             {   log( out, "FileDrop: IOException - abort:" );

Reply via email to