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

FileDialog crashes when using FilenameFilter on sandboxed OSX Mojave (10.14) app

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      ADDITIONAL SYSTEM INFORMATION :
      MacOS X, Mojave (10.14), Sandboxed App, Java 8. The entitlement in entitlements.plist is set to: <key>com.apple.security.files.user-selected.read-write</key><true/>


      A DESCRIPTION OF THE PROBLEM :
      When an sandboxed application built for the MacOS App Store uses java.awt.FileDialog and sets a FilenameFilter, the app crashes under Mojave (10.14). It previously worked in High Sierra (10.13) and previous versions. It also works when not sandboxed in Mojave.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a java.awt.FileDialog object, attempt to call setFilenameFilter method on the object. The application will crash.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expecting the application will show a native file dialog with the filter applied.
      ACTUAL -
      Application crashes. Log for crashed thread is below. Note line 21. The crash always happens.

      Thread 28 Crashed:: Dispatch queue: com.apple.root.default-qos
      0 libsystem_kernel.dylib 0x00007fff5814b23e __pthread_kill + 10
      1 libsystem_pthread.dylib 0x00007fff58201c1c pthread_kill + 285
      2 libsystem_c.dylib 0x00007fff580b41c9 abort + 127
      3 libjvm.dylib 0x0000000111075ad9 os::abort(bool) + 25
      4 libjvm.dylib 0x000000011119dd22 VMError::report_and_die() + 2304
      5 libjvm.dylib 0x000000011107771e JVM_handle_bsd_signal + 1131
      6 libjvm.dylib 0x0000000111073963 signalHandler(int, __siginfo*, void*) + 47
      7 libsystem_platform.dylib 0x00007fff581f6b3d _sigtramp + 29
      8 libsystem_asl.dylib 0x00007fff580567f5 0x7fff5803f000 + 96245
      9 libjvm.dylib 0x0000000110ed7b68 JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*) + 1372
      10 libjvm.dylib 0x0000000110ed845e JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*) + 356
      11 libjvm.dylib 0x0000000110ed85b6 JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Handle, Thread*) + 86
      12 libjvm.dylib 0x0000000111128836 SystemDictionary::load_instance_class(Symbol*, Handle, Thread*) + 728
      13 libjvm.dylib 0x0000000111127ffe SystemDictionary::resolve_instance_class_or_null(Symbol*, Handle, Handle, Thread*) + 1156
      14 libjvm.dylib 0x0000000111128a52 SystemDictionary::resolve_or_null(Symbol*, Handle, Handle, Thread*) + 262
      15 libjvm.dylib 0x0000000111129105 SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*) + 49
      16 libjvm.dylib 0x0000000110f302f9 find_class_from_class_loader(JNIEnv_*, Symbol*, unsigned char, Handle, Handle, unsigned char, Thread*) + 48
      17 libjvm.dylib 0x0000000110efd3cc jni_FindClass + 588
      18 JavaNativeFoundation 0x00007fff2ef913a3 JNFLookupClass + 25
      19 JavaNativeFoundation 0x00007fff2ef914a6 JNFLookupMemberID + 32
      20 JavaNativeFoundation 0x00007fff2ef92841 JNFCallBooleanMethod + 152
      21 libawt_lwawt.dylib 0x000000012cff0efc -[CFileDialog askFilenameFilter:] + 88
      22 libawt_lwawt.dylib 0x000000012cff0e8d -[CFileDialog panel:shouldEnableURL:] + 156
      23 com.apple.AppKit 0x00007fff28d979a8 __59-[NSVBSavePanel requestAppEnabledStateForItems:replyToken:]_block_invoke + 596
      24 libdispatch.dylib 0x00007fff57fbcd53 _dispatch_call_block_and_release + 12
      25 libdispatch.dylib 0x00007fff57fbddcf _dispatch_client_callout + 8
      26 libdispatch.dylib 0x00007fff57fc0240 _dispatch_queue_override_invoke + 767
      27 libdispatch.dylib 0x00007fff57fcbd26 _dispatch_root_queue_drain + 325
      28 libdispatch.dylib 0x00007fff57fcc4bd _dispatch_worker_thread2 + 90
      29 libsystem_pthread.dylib 0x00007fff581fe6dd _pthread_wqthread + 619
      30 libsystem_pthread.dylib 0x00007fff581fe405 start_wqthread + 13

      ---------- BEGIN SOURCE ----------
       java.awt.FileDialog diag = new java.awt.FileDialog(null, "Select File", FileDialog.LOAD);

      //Adding the Filename filter below will cause a crash. Remove it and it works as expected
      diag.setFilenameFilter(new FilenameFilter() {
             @Override
              public boolean accept(File dir, String name) {
                      return name.matches(".png");
              }
        });
               
       diag.setVisible(true);

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

      CUSTOMER SUBMITTED WORKAROUND :
      Do not set a FilenameFilter.

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            pardesha Pardeep Sharma
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: