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

Using java.awt.FileDialog causes an OS error on Mac

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 8u31
    • client-libs
    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_31"
      Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.9 and 10.10 (including 10.10.2)

      A DESCRIPTION OF THE PROBLEM :
      When a java.awt.FileDialog has setVisible(ture) called the OS reports an error.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a java.awt.FileDialog and call setVisible(true).


      1 . Compile the attached test case.
      2. Run it with:
              java -classpath /path/to/compiled/class -Dapple.laf.useScreenMenuBar=true ChooserTest
          or
              java -classpath /path/to/compiled/class ChooserTest
          (ScreenMenuBar doesn't make any difference)
      3. Select File -> Open in the menu.
      4. The error message is displayed on the terminal.the terminal.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Dialog displays.
      ACTUAL -
      Dialog displays and the error is reported from the OS.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java[1928:607073] Unable to simultaneously satisfy constraints:
      (
          "<NSAutoresizingMaskLayoutConstraint:0x7f8ab3ba7530 h=--& v=--& V:[FI_TBrowserBackgroundView:0x7f8ab3c849a0(0)]>",
          "<NSAutoresizingMaskLayoutConstraint:0x7f8ab3ba6f40 h=-&- v=-&- V:|-(0)-[FI_TListScrollView:0x7f8ab3c6b2b0] (Names: '|':FI_TBrowserBackgroundView:0x7f8ab3c849a0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7f8ab3ba6ef0 h=-&- v=-&- V:[FI_TListScrollView:0x7f8ab3c6b2b0]-(0)-| (Names: '|':FI_TBrowserBackgroundView:0x7f8ab3c849a0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7f8ab3b7e840 h=-&- v=-&- V:[NSClipView:0x7f8ab3c6ae80]-(15)-| (Names: '|':FI_TListScrollView:0x7f8ab3c6b2b0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7f8ab3b7e7f0 h=-&- v=-&- V:|-(0)-[NSClipView:0x7f8ab3c6ae80] (Names: '|':FI_TListScrollView:0x7f8ab3c6b2b0 )>"
      )

      Will attempt to recover by breaking constraint
      <NSAutoresizingMaskLayoutConstraint:0x7f8ab3b7e840 h=-&- v=-&- V:[NSClipView:0x7f8ab3c6ae80]-(15)-| (Names: '|':FI_TListScrollView:0x7f8ab3c6b2b0 )>

      Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens. And/or, break on objc_exception_throw to catch this in the debugger.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.InputEvent;
      import java.awt.event.KeyEvent;

      public class ChooserTest extends JFrame {

        public ChooserTest() {
          JPanel panel = new JPanel();
          panel.setPreferredSize(new Dimension(500, 200));
          getContentPane().add(panel, BorderLayout.CENTER);

          JMenuBar menuBar = new JMenuBar();
          JMenu fileMenu = new JMenu();
          fileMenu.setText("File");

          JMenuItem fileOpenMenuItem = new JMenuItem();
          fileOpenMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.META_MASK));
          fileOpenMenuItem.setText("Open");
          fileOpenMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              fileOpenMenuItemActionPerformed(evt);
            }
          });
          fileMenu.add(fileOpenMenuItem);
          menuBar.add(fileMenu);

          setJMenuBar(menuBar);

          pack();

        }

        public void fileOpenMenuItemActionPerformed(ActionEvent evt) {
          FileDialog dialog = new FileDialog(this);
          dialog.setVisible(true);
        }

        public static void main(final String args[]) {
          java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
              ChooserTest chooserTest = new ChooserTest();
              chooserTest.setVisible(true);
             }
          });
        }

      }

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

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: