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

Unexpected NullPointerException by InputContext.endComposition()

    XMLWordPrintable

Details

    • b17
    • generic, x86
    • os_x, windows_xp

    Backports

      Description

        SYNOPSIS
        --------
        Unexpected NullPointerException by InputContext.endComposition()

        OPERATING SYSTEM
        ----------------
        Windows (tested on XP, Vista, Server 2008)

        FULL JDK VERSION
        ----------------
        All 5.0, 6 and 7

        DESCRIPTION:
        ------------
        When I use JavaIM (CodePointIM) on JTextArea, unexpected
        NullPointerException is happened by InputContext.endComposition()

        The problem is not seen when using Japanese MS-IME.

        REPRODUCTION INSTRUCTIONS
        -------------------------
        Testcase:
        1. Copy CodePointIM.jar which is in demo\jfc\CodoPointIM directory
           to jre\lib\ext directory
        2. Compile and run above test program
        3. On Window menu, select "Switch Input Method"
        4. Select "CodePoint Input Method"
        5. Type "\u3042" and press right mouse button on JTextArea.
           Then following NullPointerException is displayed

        ================================================================
        Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
                at sun.swing.SwingUtilities2.getAdjustedClickCount(SwingUtilities2.java:1647)
                at javax.swing.text.DefaultCaret.mouseClicked(DefaultCaret.java:406)
                at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
                at java.awt.Component.processMouseEvent(Component.java:6433)
                at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
                at java.awt.Component.processEvent(Component.java:6195)
                at java.awt.Container.processEvent(Container.java:2203)
                at java.awt.Component.dispatchEventImpl(Component.java:4790)
                at java.awt.Container.dispatchEventImpl(Container.java:2261)
                at java.awt.Component.dispatchEvent(Component.java:4616)
                at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4800)
                at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4472)
                at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4393)
                at java.awt.Container.dispatchEventImpl(Container.java:2247)
                at java.awt.Window.dispatchEventImpl(Window.java:2671)
                at java.awt.Component.dispatchEvent(Component.java:4616)
                at java.awt.EventQueue.dispatchEvent(EventQueue.java:651)
                at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:255)
                at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:170)
                at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:160)
                at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:155)
                at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
                at java.awt.EventDispatchThread.run(EventDispatchThread.java:136)
        ================================================================

        TESTCASE SOURCE
        ---------------

        import java.awt.*;
        import java.awt.event.*;
        import javax.swing.*;
        import java.util.Date;

        class MouseEventTest2 extends JFrame implements MouseListener {
            JTextArea text;
            MouseEventTest2() {
                setTitle("MouseEventTest2");
                Container c = getContentPane();
                c.setLayout(new GridLayout(1,0));
                text = new JTextArea();
                text.addMouseListener(this);
                c.add(text);
                setSize(300,200);
                setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                setVisible(true);
            }
            public void mouseClicked(MouseEvent me) {
                if (me.getButton() == MouseEvent.BUTTON3) {
                    text.getInputContext().endComposition();
                    System.out.println((new Date()).toString()+"; endComposition() is called");
                }
            };
            public void mousePressed(MouseEvent me) {};
            public void mouseReleased(MouseEvent me) {};
            public void mouseEntered(MouseEvent me) {};
            public void mouseExited(MouseEvent me) {};
            public static void main(String[] args) {
                new MouseEventTest2();
            }
        }

        Attachments

          Issue Links

            Activity

              People

                rupashka Pavel Porvatov (Inactive)
                dkorbel David Korbel (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: