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

Win32: exception thrown when adding a component for the second time

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.3.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:

      Description



      Name: dsC76792 Date: 02/02/2000

      ###@###.###

      Run the following test case:
      ---------------------------------------------------------------------
      import java.awt.*;
      import java.awt.event.*;

      public class Test extends WindowAdapter implements ActionListener {

          final Frame frame = new Frame("Frame");
          final TextField textfield = new TextField("Click the button");
          final Button button = new Button("Click me");

          public Test() {
              button.addActionListener(this);
              frame.setLayout(new FlowLayout());
              frame.add(textfield);
              frame.add(button);
              frame.pack();
              frame.addWindowListener(this);
              frame.setVisible(true);
          }

          public void actionPerformed(ActionEvent e) {
              textfield.setText("Move mouse over me");
              frame.add(textfield);
              frame.pack();
          }

          public void windowClosing(WindowEvent e) {
              System.exit(0);
          }

          public static void main(String[] args) {
              Test test = new Test();
          }
      }
      ---------------------------------------------------------------------

      Click the button. Move the mouse over a text field.
      The test will throw multiple identical exceptions:

      Exception occurred during event dispatching:
      java.lang.NullPointerException: null pData
              at sun.awt.windows.WInputMethod.handleNativeIMEEvent(Native Method)
              at sun.awt.windows.WInputMethod.dispatchEvent(WInputMethod.java:279)
              at sun.awt.im.InputContext.dispatchEvent(InputContext.java:206)
              at sun.awt.im.InputMethodContext.dispatchEvent(InputMethodContext.java:181)
              at java.awt.Component.dispatchEventImpl(Component.java:2533)
              at java.awt.Component.dispatchEvent(Component.java:2503)
              at java.awt.EventQueue.dispatchEvent(EventQueue.java:323)
              at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:107)
              at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:97)
              at java.awt.EventDispatchThread.run(EventDispatchThread.java:88)

      After that the text field doesn't react on user input.
      The only way to restore its normal operation is to
      tab-traverse to it from the button.

      Possible cause is that when the focussed component changes we memorize
      a reference to the peer of the heavyweight container nearest to the new
      focus owner. The test case causes replacement of the text field's peer
      with a new one, since we add the same text field to the same frame twice.

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              naoto Naoto Sato
              Reporter:
              dassunw Das Das (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: