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

Pasting G2 surrogate characters from native app to a JTextField fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • client-libs
    • x86
    • windows_xp

      OPERATING SYSTEM
      ----------------
      Windows and Linux

      FULL JDK VERSION
      ----------------
      All Java 6 releases.
      Not reproducible on 5.0 => regression.

      RECREATION INSTRUCTIONS
      -----------------------

      1. Compile and run program TextIssue.java
         You should see a Window with a text field, containing 8 squares.

      2. Click inside the Java text field, select all, copy (Ctrl A Ctrl C)
         This copies the content into the system clipboard

      3. Click on the Java text field, select all, paste (Ctrl A Ctrl V)
         -> works fine (you still see the 8 squares you copied earlier)

      4. Open an native application with a text field (e.g. Eclipse, Notepad,
         Wordpad for example on Windows, or even the address bar of any
         browser)

      5. Click inside the native text field, paste again (Ctrl A Ctrl V)
         -> works fine (you still see the 8 squares you copied earlier in
         this editor)

      6) In that native text field, select all, copy (Ctrl A Ctrl C)
         This should copy the exact same content you just pasted into the
         system clipboard
       
      7) Click on the java text field, select all, paste (Ctrl A Ctrl V)
         This is the problem -> Nothing is pasted and the squares disappear.

      This may be related to CR 6586945.

      TESTCASE SOURCE
      ---------------
      import javax.swing.JFrame;
      import javax.swing.JTextField;

      public class TextIssue {
          public static void main(String[] args) {
              JFrame f= new JFrame();
              String s = "\uD840\uDC00\uD840\uDC01\uD840\uDC02\uD840\uDC03\uD840\uDC04\uD869\uDED4\uD869\uDED5\uD869\uDED6";
              final JTextField area = new JTextField(s);
              area.setEditable(true);
              f.getContentPane().add(area);
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.pack();
              f.setVisible(true);
          }
      }

      Release Regression From : 5.0
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            uta Alexey Utkin (Inactive)
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: