8189667: Desktop#moveToTrash expects incorrect "<<ALL FILES>>" FilePermission
authorserb
Wed, 08 Aug 2018 15:51:08 -0700
changeset 51363 a6fa2016cff1
parent 51362 72d0f57cef00
child 51364 31d9e82b2e64
8189667: Desktop#moveToTrash expects incorrect "<<ALL FILES>>" FilePermission Reviewed-by: prr, sveerabhadra
src/java.desktop/share/classes/java/awt/Desktop.java
--- a/src/java.desktop/share/classes/java/awt/Desktop.java	Wed Aug 08 15:11:11 2018 -0400
+++ b/src/java.desktop/share/classes/java/awt/Desktop.java	Wed Aug 08 15:51:08 2018 -0700
@@ -42,7 +42,6 @@
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Objects;
@@ -85,10 +84,6 @@
  * application is executed, it will be executed on the same system as
  * the one on which the Java application was launched.
  *
- * <p> Note: the methods in the {@code Desktop} class may require
- * platform-dependent permissions in addition to those described in the
- * specification.
- *
  * @see Action
  *
  * @since 1.6
@@ -389,11 +384,12 @@
 
 
     /**
-     *  Calls to the security manager's {@code checkPermission} method with
-     *  an {@code AWTPermission("showWindowWithoutWarningBanner")}
-     *  permission.
+     * Calls to the security manager's {@code checkPermission} method with an
+     * {@code AWTPermission("showWindowWithoutWarningBanner")} permission. This
+     * permission is needed, because we cannot add a security warning icon to
+     * the windows of the external native application.
      */
-    private void checkAWTPermission(){
+    private void checkAWTPermission() {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             sm.checkPermission(new AWTPermission(
@@ -938,7 +934,11 @@
      * and registered in the Info.plist with CFBundleHelpBookFolder
      *
      * @throws SecurityException if a security manager exists and it denies the
-     * {@code RuntimePermission("canProcessApplicationEvents")} permission.
+     *         {@code RuntimePermission("canProcessApplicationEvents")}
+     *         permission, or it denies the
+     *         {@code AWTPermission("showWindowWithoutWarningBanner")}
+     *         permission, or the calling thread is not allowed to create a
+     *         subprocess
      * @throws UnsupportedOperationException if the current platform
      * does not support the {@link Desktop.Action#APP_HELP_VIEWER} action
      * @since 9
@@ -982,12 +982,15 @@
      * @param file the file
      * @throws SecurityException If a security manager exists and its
      *         {@link SecurityManager#checkRead(java.lang.String)} method
-     *         denies read access to the file
+     *         denies read access to the file or to its parent, or it denies the
+     *         {@code AWTPermission("showWindowWithoutWarningBanner")}
+     *         permission, or the calling thread is not allowed to create a
+     *         subprocess
      * @throws UnsupportedOperationException if the current platform
      *         does not support the {@link Desktop.Action#BROWSE_FILE_DIR} action
      * @throws NullPointerException if {@code file} is {@code null}
-     * @throws IllegalArgumentException if the specified file doesn't
-     * exist
+     * @throws IllegalArgumentException if the specified file or its parent
+     *         doesn't exist
      * @since 9
      */
     public void browseFileDirectory(File file) {
@@ -1014,8 +1017,7 @@
      * @throws UnsupportedOperationException if the current platform
      *         does not support the {@link Desktop.Action#MOVE_TO_TRASH} action
      * @throws NullPointerException if {@code file} is {@code null}
-     * @throws IllegalArgumentException if the specified file doesn't
-     * exist
+     * @throws IllegalArgumentException if the specified file doesn't exist
      *
      * @since 9
      */