-
Bug
-
Resolution: Unresolved
-
P3
-
8, 11, 17, 19, 20
-
x86_64
-
linux_ubuntu
ADDITIONAL SYSTEM INFORMATION :
Description: Ubuntu 20.04 LTS
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
$ uname -v
#62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022
$ uname -srmpio
Linux 5.15.0-56-generic x86_64 x86_64 x86_64 GNU/Linux
Java 19, Java 17, Java 13, Java 8 (the bug is there on all of them)
Brave: Version 1.34.81 Chromium: 97.0.4692.99 (Official Build) (64-bit)
Chromium: Version 108.0.5359.124 (Official Build) snap (64-bit)
Firefox: 99.0 (64-bit) (but with Firefox it works ok)
Firefox: 108.0.1 (64-bit) (but with Firefox it works ok)
A DESCRIPTION OF THE PROBLEM :
This issue has been described (not by me) in:
<link>
The issue happens when dragging images or text from Chromium or Brave (I saw it myself), the above link reports that the problem happens with Chrome too.
The problem is that when dragging from Chromium to a Java app, TransferHandler.canImport() is not called at all. (It is called and works as expected when dragging from Firefox to a Java app, and dragging from Chromium to Gedit also works)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Write a program with a TransferHandler, for example, take the code from
https://stackoverflow.com//a/31655081
(attached to this bug report)
or from the Oracle tutorial,
or from the very 1st link that I provided
2. add a System.out.println("--- canImport") into the definition of canImport() (override both signatures, it will not work anyway)
3. To be sure that it works with other browsers, drag and drop something from Firefox (some selected text or an image) -- it will work with Firefox, you will see that canImport() is called.
4. Try to drag text from Brave or Chromium to gedit -- it will work
5. Run the Java program from the step 1 and try to drag text of images from Brave or Chromium to that program. You will see that canImport() is not called, neither the old nor the new version of that method.
Expected: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() must be called
Actual: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() is not called
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() must be called
ACTUAL -
Actual: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() is not called
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Main
{
private final JFrame frame;
private Main ()
{
frame = new JFrame ();
frame.setSize (640, 480);
//
// window init stuff
//
frame.setVisible (true);
// add handler to exit on window close
frame.addWindowListener (new WindowAdapter()
{
@Override
public void windowClosing (WindowEvent e)
{
System.exit (0);
}
});
// drop handler to deal with receiving drag
// and drop events
frame.setTransferHandler (new TransferHandler () {
@Override
public boolean canImport (TransferSupport support)
{
System.out.printf ("canImport called...\n");
return super.canImport (support);
}
});
}
public static void main (String[] args)
{
new Main ();
}
}
<link>
---------- END SOURCE ----------
FREQUENCY : always
Description: Ubuntu 20.04 LTS
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
$ uname -v
#62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022
$ uname -srmpio
Linux 5.15.0-56-generic x86_64 x86_64 x86_64 GNU/Linux
Java 19, Java 17, Java 13, Java 8 (the bug is there on all of them)
Brave: Version 1.34.81 Chromium: 97.0.4692.99 (Official Build) (64-bit)
Chromium: Version 108.0.5359.124 (Official Build) snap (64-bit)
Firefox: 99.0 (64-bit) (but with Firefox it works ok)
Firefox: 108.0.1 (64-bit) (but with Firefox it works ok)
A DESCRIPTION OF THE PROBLEM :
This issue has been described (not by me) in:
<link>
The issue happens when dragging images or text from Chromium or Brave (I saw it myself), the above link reports that the problem happens with Chrome too.
The problem is that when dragging from Chromium to a Java app, TransferHandler.canImport() is not called at all. (It is called and works as expected when dragging from Firefox to a Java app, and dragging from Chromium to Gedit also works)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Write a program with a TransferHandler, for example, take the code from
https://stackoverflow.com//a/31655081
(attached to this bug report)
or from the Oracle tutorial,
or from the very 1st link that I provided
2. add a System.out.println("--- canImport") into the definition of canImport() (override both signatures, it will not work anyway)
3. To be sure that it works with other browsers, drag and drop something from Firefox (some selected text or an image) -- it will work with Firefox, you will see that canImport() is called.
4. Try to drag text from Brave or Chromium to gedit -- it will work
5. Run the Java program from the step 1 and try to drag text of images from Brave or Chromium to that program. You will see that canImport() is not called, neither the old nor the new version of that method.
Expected: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() must be called
Actual: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() is not called
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() must be called
ACTUAL -
Actual: when dragging text or image from Chromium to a Java program, TransferHandler.canImport() is not called
---------- BEGIN SOURCE ----------
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Main
{
private final JFrame frame;
private Main ()
{
frame = new JFrame ();
frame.setSize (640, 480);
//
// window init stuff
//
frame.setVisible (true);
// add handler to exit on window close
frame.addWindowListener (new WindowAdapter()
{
@Override
public void windowClosing (WindowEvent e)
{
System.exit (0);
}
});
// drop handler to deal with receiving drag
// and drop events
frame.setTransferHandler (new TransferHandler () {
@Override
public boolean canImport (TransferSupport support)
{
System.out.printf ("canImport called...\n");
return super.canImport (support);
}
});
}
public static void main (String[] args)
{
new Main ();
}
}
<link>
---------- END SOURCE ----------
FREQUENCY : always