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

Pasting Images on Linux Platform from System Clipboard fails often

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      linux_ubuntu

      Description

      FULL PRODUCT VERSION :
      java -version
      java version "1.7.0_72"
      Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux Europa 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      It seems this is a duplicate of Bug JDK-7191086.

      The problem only occurs on the Linux Platform. Windows 7 is working.

      Pasting image which is ~ 1MB of size will cause a execption to occur!

      See output here from testcase created (attached below):

      Getting data from Clipboard
      Fetching image
      Error from Clipboard!!!!!!!!
      java.io.IOException: Owner failed to convert data
      at sun.awt.X11.XSelection.validateDataGetter(XSelection.java:444)
      at sun.awt.X11.XSelection.getData(XSelection.java:378)done
      at sun.awt.X11.XClipboard.getClipboardData(XClipboard.java:120)
      at sun.awt.datatransfer.ClipboardTransferable.fetchOneFlavor(ClipboardTransferable.java:117)
      at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:97)
      at sun.awt.X11.XClipboard.getContents(XClipboard.java:106)
      at PasteTest.paste(PasteTest.java:26)
      at PasteTest.main(PasteTest.java:51)



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.) Open with a browser e.g. Firefox a large picture (size > 1MB) and copy the graphic into the clipboard.
      2.) Run test case several times. You should see it fail

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No expection to occur!
      ACTUAL -
      Exception occurs!

      REPRODUCIBILITY :
      This bug can be reproduced often.

      ---------- BEGIN SOURCE ----------
      import java.awt.Image;
      import java.awt.Toolkit;
      import java.awt.datatransfer.Clipboard;
      import java.awt.datatransfer.DataFlavor;
      import java.awt.datatransfer.Transferable;
      import java.awt.datatransfer.UnsupportedFlavorException;
      import java.io.IOException;
      import java.io.LineNumberReader;
      import java.io.Reader;

      import Error.PMMessage;
      import PM.PPM;


      public class PasteTest {
      static private void paste() {


      Clipboard clipboard = PPM.getClipboard();

      clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();


      if (clipboard != null) {
      Transferable t = clipboard.getContents(null);

      System.out.println("Getting data from Clipboard");
      if (t != null && t.isDataFlavorSupported(DataFlavor.imageFlavor)) {
      Image image = null;
      System.out.println("Fetching image");
      try {
      image = (Image) t.getTransferData(DataFlavor.imageFlavor);
      } catch (UnsupportedFlavorException e) {
      // TODO Auto-generated catch block
      System.out.println("Unsupported Flavor error");
      e.printStackTrace();

      } catch (IOException e) {
      // TODO Auto-generated catch block
      System.out.println("Error from Clipboard!!!!!!!!");
      e.printStackTrace();
      }
      }
      System.out.println("done");
      }

      }

      public static void main(String [] args) {
      paste();
      }
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aivanov Alexey Ivanov
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: