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

[macosx] Using java.awt.FileDialog causes an OS error on Mac - FileDialog.LOAD only

XMLWordPrintable

    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_60"
      Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
      Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.10.5 BuildVersion: 14F27

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      MacBook

      A DESCRIPTION OF THE PROBLEM :
      Making java.awt.FileDialog and doing setVisible(true) results in a Mac OS error message to console for FileDialog.LOAD option (not .SAVE option)

      java[693:9501] Unable to simultaneously satisfy constraints... [lists various NSAutoresizingMaskLayout constraints].

      Looks very similar to a bug reported earlier this year (JDK-8074185 ?) which was closed as unreproducible.

      REGRESSION. Last worked in version 7u75

      ADDITIONAL REGRESSION INFORMATION:
      $ java -version
      $ java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

      $ sw_vers
      ProductName: Mac OS X
      ProductVersion: 10.7.5
      BuildVersion: 11G63


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      $cat <ConstraintTroubleAwtFileDialog.java
      public class ConstraintTroubleAwtFileDialog extends javax.swing.JFrame {
      public static void main(String[] args) {
      javax.swing.JFrame appJFrame = new javax.swing.JFrame("AWT File Dialog Mac Console Warning");
      appJFrame.setSize(400, 400);
      appJFrame.setVisible(true);
      java.awt.FileDialog iFileDialog = new java.awt.FileDialog(appJFrame, "Input File", java.awt.FileDialog.LOAD);
      iFileDialog.setVisible(true);
      }
      }
      $javac ConstraintTroubleAwtFileDialog.java
      $java ConstraintTroubleAwtFileDialog
      ... error message displays ...


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should run without any error message.
      ACTUAL -
      $java ConstraintTroubleAwtFileDialog
          [screen shows empty JFrame window, then text below appears in the Mac Terminal window and finally the correct FileDialog box appears]
      2015-10-04 14:01:07.626 java[693:9501] Unable to simultaneously satisfy constraints:
      (
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1d45a0 h=--& v=--& V:[FI_TBrowserBackgroundView:0x7fe1ee2a57a0(0)]>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1682f0 h=-&- v=-&- V:|-(0)-[FI_TListScrollView:0x7fe1ee19f2c0] (Names: '|':FI_TBrowserBackgroundView:0x7fe1ee2a57a0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1682a0 h=-&- v=-&- V:[FI_TListScrollView:0x7fe1ee19f2c0]-(0)-| (Names: '|':FI_TBrowserBackgroundView:0x7fe1ee2a57a0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1c1e90 h=-&- v=-&- V:[NSClipView:0x7fe1ee19ef10]-(15)-| (Names: '|':FI_TListScrollView:0x7fe1ee19f2c0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1c0940 h=-&- v=-&- V:|-(0)-[NSClipView:0x7fe1ee19ef10] (Names: '|':FI_TListScrollView:0x7fe1ee19f2c0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1c1f90 h=-&- v=-&- V:[FI_TListView:0x7fe1ee19e910]-(0)-| (Names: '|':NSClipView:0x7fe1ee19ef10 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1a9700 h=-&- v=-&- V:|-(0)-[FI_TListView:0x7fe1ee19e910] (Names: '|':NSClipView:0x7fe1ee19ef10 )>"
      )

      Will attempt to recover by breaking constraint
      <NSAutoresizingMaskLayoutConstraint:0x7fe1ee1c1f90 h=-&- v=-&- V:[FI_TListView:0x7fe1ee19e910]-(0)-| (Names: '|':NSClipView:0x7fe1ee19ef10 )>

      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.
      2015-10-04 14:01:07.656 java[693:9501] Unable to simultaneously satisfy constraints:
      (
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1d45a0 h=--& v=--& V:[FI_TBrowserBackgroundView:0x7fe1ee2a57a0(0)]>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1682f0 h=-&- v=-&- V:|-(0)-[FI_TListScrollView:0x7fe1ee19f2c0] (Names: '|':FI_TBrowserBackgroundView:0x7fe1ee2a57a0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1682a0 h=-&- v=-&- V:[FI_TListScrollView:0x7fe1ee19f2c0]-(0)-| (Names: '|':FI_TBrowserBackgroundView:0x7fe1ee2a57a0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1c1e90 h=-&- v=-&- V:[NSClipView:0x7fe1ee19ef10]-(15)-| (Names: '|':FI_TListScrollView:0x7fe1ee19f2c0 )>",
          "<NSAutoresizingMaskLayoutConstraint:0x7fe1ee1c0940 h=-&- v=-&- V:|-(0)-[NSClipView:0x7fe1ee19ef10] (Names: '|':FI_TListScrollView:0x7fe1ee19f2c0 )>"
      )

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

      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.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      see above

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class ConstraintTroubleAwtFileDialog extends javax.swing.JFrame {
      public static void main(String[] args) {
      javax.swing.JFrame appJFrame = new javax.swing.JFrame("AWT File Dialog Mac Console Warning");
      appJFrame.setSize(400, 400);
      appJFrame.setVisible(true);
      java.awt.FileDialog iFileDialog = new java.awt.FileDialog(appJFrame, "Input File", java.awt.FileDialog.LOAD);
      iFileDialog.setVisible(true);
      }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Either have to tolerate error output, or switch to JFileChooser; however, JFileChooser is unfamiliar to many Mac users.

            mhalder Manajit Halder (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: