JDK-8227836 : [macos 10.15] FileDialog not working in macOS 10.15 Beta
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 12,13,14
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: os_x
  • CPU: x86
  • Submitted: 2019-07-15
  • Updated: 2020-11-20
  • Resolved: 2020-11-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
macOS 10.15 Catalina, Beta

A DESCRIPTION OF THE PROBLEM :
When trying to show a FileDialog in macOS 10.15 Beta the dialog doesn't open and I get the following error message:

2019-07-12 15:26:40.451 java[17097:242412] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted

Looks like in macOS Beta all panels behave as if they were sandboxed. Here are some resources I've found about people having this same issue:

https://github.com/xamarin/xamarin-macios/issues/6474
https://www.emaculation.com/forum/viewtopic.php?f=20&t=10249&sid=2b8ec1b2576eece87a89f8dbc2355d89

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Build the simple FileDialog example provided, press the button to open the dialog.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
File Dialog should open.
ACTUAL -
The console prints:
2019-07-12 15:26:40.451 java[17097:242412] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted

---------- BEGIN SOURCE ----------
// Source code taken from https://www.tutorialspoint.com/awt/awt_filedialog

package com.tutorialspoint.gui;

import java.awt.*;
import java.awt.event.*;

public class AwtControlDemo {

   private Frame mainFrame;
   private Label headerLabel;
   private Label statusLabel;
   private Panel controlPanel;

   public AwtControlDemo(){
      prepareGUI();
   }

   public static void main(String[] args){
      AwtControlDemo  awtControlDemo = new AwtControlDemo();
      awtControlDemo.showFileDialogDemo();
   }

   private void prepareGUI(){
      mainFrame = new Frame("Java AWT Examples");
      mainFrame.setSize(400,400);
      mainFrame.setLayout(new GridLayout(3, 1));
      mainFrame.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent windowEvent){
            System.exit(0);
         }        
      });    
      headerLabel = new Label();
      headerLabel.setAlignment(Label.CENTER);
      statusLabel = new Label();        
      statusLabel.setAlignment(Label.CENTER);
      statusLabel.setSize(350,100);

      controlPanel = new Panel();
      controlPanel.setLayout(new FlowLayout());

      mainFrame.add(headerLabel);
      mainFrame.add(controlPanel);
      mainFrame.add(statusLabel);
      mainFrame.setVisible(true);  
   }

   private void showFileDialogDemo(){
      headerLabel.setText("Control in action: FileDialog"); 

      final FileDialog fileDialog = new FileDialog(mainFrame,"Select file");
      Button showFileDialogButton = new Button("Open File");
      showFileDialogButton.addActionListener(new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
            fileDialog.setVisible(true);
            statusLabel.setText("File Selected :" 
            + fileDialog.getDirectory() + fileDialog.getFile());
         }
      });

      controlPanel.add(showFileDialogButton);
      mainFrame.setVisible(true);  
   }
}
---------- END SOURCE ----------


Comments
I am seeing this problem occasionaly on macOS 10.15.6. I'm wondering if it might be caused by a timeout in AppKit.
08-09-2020

Cannot reproduce it as well on macOS Catalina 10.15 Beta (19A546d) August 28, 2019.
29-08-2019

The bug is not reproduced anymore in macOS Catalina 10.15 Beta (19A546d) August 28, 2019
28-08-2019

This can be reproduced using attached small standalone test. 1 Save the main.m file somewhere 2 Compile and run: clang -framework Cocoa main.m -o testDialog && ./testDialog 3 the next error will be printed: 2019-07-30 17:52:30.268 testDialog[2962:61682] NSSoftLinking - The function 'SLSIsSuppressedByScreenTime' can't be found in the (null) framework. 2019-07-30 17:52:30.364 testDialog[2962:61694] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted Error panel is null 4 Save Info.plist near the testDialog 5 Run the app ./testDialog 6 Error will not be printed and the panel will not be null
06-08-2019

FB6809634: [NSOpenPanel openPanel] always returns nil and produces an error in the log
06-08-2019

I can reproduce it using jdk12(I guess all version of java are affected) and the latest beta of macOS 10.15 Catalina. The PrintDialog produces this warning: java[2543:50557] *** Assertion failure in -[RemotePDEHost loadRemotePDEHost], /BuildRoot/Library/Caches/com.apple.xbs/Sources/PrintingPlugins/PrintingPlugins-605/PrintCocoaUI/RemotePDEHost.mm:543
31-07-2019

I can reproduce it as well on JDK 12.0.2 and JDK 8u221. I note that JFileChooser does not have this same problem. It works fine on 10.15 Catalina.
25-07-2019

The same issue was reported against JavaFX FileChooser: JDK-8228457
22-07-2019

Issue is reported with macOS 10.15 Beta and JDK 12.0.1, where the FileDialog fails to work. When checked with JDK 12.0.1 running in macOS X 10.13.6, it works fine as the File Dialog open as expected. However, this need to be verified in macOS 10.15 Beta for related verification.
17-07-2019