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

[macos 10.15] FileDialog not working in macOS 10.15 Beta

XMLWordPrintable

    • x86
    • os_x

      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 ----------

        1. AwtControlDemo.java
          2 kB
          Pardeep Sharma
        2. Info.plist
          0.3 kB
          Sergey Bylokhov
        3. main.m
          0.2 kB
          Sergey Bylokhov

            pbansal Pankaj Bansal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: