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

IllegalArgumentException is thrown in Drag and Drop test

XMLWordPrintable

    • ppc
    • linux

      SYNOPSIS
      --------
      IllegalArgumentException is thrown in Drag and Drop test

      OPERATING SYSTEM
      ----------------
      Linux (tested with SUSE Linux Enterprise Server 10 SP2)

      FULL JDK VERSION
      ----------------
      ONLY REPRODUCIBLE ON PPC ARCHITECTURE.

      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b136)
      Java HotSpot(TM) Server VM (build 21.0-b06, mixed mode)

      DESCRIPTION
      -----------
      An IllegalArgumentException is thrown, intermittently, when you drag and drop text with Ctrl key pressed.

      REPRODUCTION INSTRUCTIONS
      -------------------------

      1. Compile and launch attached testcase
      2. Select some characters. Then drag them and keep mouse pressed.
      3. Press Ctrl key during dragging.
       => IllegalArgumentException is thrown (sometimes):

      Apr 14, 2011 11:20:13 AM sun.awt.X11.XToolkit processException
      WARNING: Exception on Toolkit threadjava.lang.IllegalArgumentException: button doesn't exist 23
            at java.awt.event.InputEvent.getMaskForButton(InputEvent.java:246)
            at sun.awt.X11.XWindow.getModifiers(XWindow.java:619)
            at sun.awt.X11.XWindow.getModifiers(XWindow.java:584)
            at sun.awt.X11.XDragSourceContextPeer.updateSourceAction(XDragSourceContextPeer.java:382)
            at sun.awt.X11.XDragSourceContextPeer.processMouseMove(XDragSourceContextPeer.java:507)
            at sun.awt.X11.XDragSourceContextPeer.doProcessEvent(XDragSourceContextPeer.java:653)
            at sun.awt.X11.XDragSourceContextPeer.processEvent(XDragSourceContextPeer.java:737)
            at sun.awt.X11.XToolkit.run(XToolkit.java:643)
            at sun.awt.X11.XToolkit.run(XToolkit.java:589)
            at java.lang.Thread.run(Thread.java:738)

      If the IllegalArgumentException is not thrown, terminate the testcase and try again.

      ANALYSIS by LICENSEE
      --------------------
      We did some analysis and found something odd in the code. Basically there is a mismatch between the number
      of buttons/masks defined in InputEvent Vs Xwindow. In XWindow class we have defined 24 buttons and its
      related masks. But, in InputEvent class we have defined button masks only for 20 buttons. Hence when you
      select a button beyond 20, you will get the above exception. I'm not sure why I was getting the button
      number as 23, as I tested it with only 2 button mouse. Can you explain the appearance of "button 23" in
      the exception, when we are testing using a two button mouse?


      TESTCASE
      --------
      import java.awt.*;
      import javax.swing.*;
      public class JTextAreaDnDSrc extends JTextArea {
        public JTextAreaDnDSrc() {
            super("Drag Source");
            setDragEnabled(true);
        }
       
        public static void main(String[] args) {
            JFrame frame = new JFrame("JTextArea - Drag Source");
            frame.getContentPane().add(new JTextAreaDnDSrc());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(200, 100);
            frame.show();
        }
      }

            Unassigned Unassigned
            dkorbel David Korbel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: