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

FileOpenService and FileSaveService do not work in Java Web Start 12.0.0.0

XMLWordPrintable

    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      Java Web Start 12.0.0.0
      Using JRE version 9+181 Java HotSpot(TM) 64-Bit Server VM
      JRE expiration date: 3.2.2018 0.00

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      When calling the openFileDialog method on FileOpenService, a security exception is thrown and the file dialog does not open

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Get the FileOpenService from the ServiceManager and try to call the openFileDialog method


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      File dialog opens
      ACTUAL -
      File dialog does not open

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Commence loading file
      Looking up FileOpenService
      javax.jnlp.BasicService
      javax.jnlp.FileOpenService
      javax.jnlp.FileSaveService
      javax.jnlp.DownloadService
      javax.jnlp.ClipboardService
      javax.jnlp.PersistenceService
      javax.jnlp.PrintService
      javax.jnlp.ExtendedService
      javax.jnlp.SingleInstanceService
      Opening dialog
      java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.com.sun.java.swing.plaf.windows")
      at java.base/java.security.AccessControlContext.checkPermission(Unknown Source)
      at java.base/java.security.AccessController.checkPermission(Unknown Source)
      at java.base/java.lang.SecurityManager.checkPermission(Unknown Source)
      at jdk.javaws@9/com.sun.javaws.security.JavaWebStartSecurity.checkPermission(Unknown Source)
      at java.base/java.lang.SecurityManager.checkPackageAccess(Unknown Source)
      at java.base/sun.reflect.misc.ReflectUtil.checkPackageAccess(Unknown Source)
      at java.desktop/javax.swing.UIDefaults.getUIClass(Unknown Source)
      at java.desktop/javax.swing.UIDefaults.getUI(Unknown Source)
      at java.desktop/javax.swing.UIManager.getUI(Unknown Source)
      at java.desktop/javax.swing.JRootPane.updateUI(Unknown Source)
      at java.desktop/javax.swing.JRootPane.<init>(Unknown Source)
      at java.desktop/javax.swing.JDialog.createRootPane(Unknown Source)
      at java.desktop/javax.swing.JDialog.dialogInit(Unknown Source)
      at java.desktop/javax.swing.JDialog.<init>(Unknown Source)
      at java.desktop/javax.swing.JDialog.<init>(Unknown Source)
      at jdk.javaws@9/com.sun.javaws.ui.JavawsSysRun$DummyDialog.<init>(Unknown Source)
      at jdk.javaws@9/com.sun.javaws.ui.JavawsSysRun.delegateFromEDT(Unknown Source)
      at jdk.javaws@9/com.sun.javaws.ui.JavawsSysRun.delegate(Unknown Source)
      at jdk.deploy@9/com.sun.deploy.util.DeploySysRun.execute(Unknown Source)
      at jdk.deploy@9/com.sun.deploy.util.DeploySysRun$2.run(Unknown Source)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at jdk.deploy@9/com.sun.deploy.util.DeploySysRun.executePrivileged(Unknown Source)
      at jdk.javaws@9/com.sun.jnlp.FileOpenServiceImpl$3.run(Unknown Source)
      at jdk.deploy@9/com.sun.deploy.util.Waiter$1.wait(Unknown Source)
      at jdk.deploy@9/com.sun.deploy.util.Waiter.runAndWait(Unknown Source)
      at jdk.javaws@9/com.sun.jnlp.FileOpenServiceImpl.openFileDialog(Unknown Source)
      at com.oilon.common.ui.MainWindow.loadFile(MainWindow.java:522)
      at com.oilon.common.ui.MainWindow.access$12(MainWindow.java:494)
      at com.oilon.common.ui.MainWindow$6.actionPerformed(MainWindow.java:252)
      at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
      at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
      at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
      at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
      at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
      at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
      at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
      at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
      at java.desktop/java.awt.Component.processEvent(Unknown Source)
      at java.desktop/java.awt.Container.processEvent(Unknown Source)
      at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
      at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
      at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
      at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
      at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
      at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
      at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
      at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
      at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
      at java.desktop/java.awt.EventQueue.access$500(Unknown Source)
      at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
      at java.desktop/java.awt.EventQueue$3.run(Unknown Source)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
      at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
      at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
      at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
      at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
      at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
      at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
      at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
      at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
      Got file contents?

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      private void loadFile(String path) {
      //ObjectInputStream restore = null;
      ObjectInputStream restore = null;
      FileOpenService fos = null;
              FileContents fileContents = null;

              if (DEBUG) {
           System.out.println("Commence loading file");
           }
              // if file path not specified -> ask for it
              if (path == null) {
               if (DEBUG) {
               System.out.println("Looking up FileOpenService");
               }
               for (String str : ServiceManager.getServiceNames())
               System.out.println(str);
      try {
      fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
      } catch (UnavailableServiceException exc) {
      exc.printStackTrace();
               }

      if (DEBUG) {
               System.out.println("Opening dialog");
               }

      if (fos != null) {
      try {
      fileContents = fos.openFileDialog(null, new String[] { "shp"});
      } catch (Exception exc) {
      exc.printStackTrace();
      }
      } else {
      if (DEBUG) {
      System.out.println("Something went wrong when loading");
      }
      }

      if (DEBUG) {
               System.out.println("Got file contents?");
               }
      if (fileContents == null)
      return;
              }
      }
      ---------- END SOURCE ----------

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

              Created:
              Updated:
              Resolved: