changeset 13179:6c56f3efe2d8

8191239: Improve desktop file usage Reviewed-by: prr, rhalade, aghaisas
author serb
date Thu, 01 Feb 2018 20:19:42 -0800
parents 6d7f74d488ff
children b4c6d8f2cf1b
files src/share/classes/java/awt/Desktop.java
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/Desktop.java	Wed Jan 31 15:43:57 2018 -0800
+++ b/src/share/classes/java/awt/Desktop.java	Thu Feb 01 20:19:42 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -202,15 +202,11 @@
      * @throws NullPointerException if file is null
      * @throws IllegalArgumentException if file doesn't exist
      */
-    private static void checkFileValidation(File file){
-        if (file == null) throw new NullPointerException("File must not be null");
-
+    private static void checkFileValidation(File file) {
         if (!file.exists()) {
             throw new IllegalArgumentException("The file: "
                                                + file.getPath() + " doesn't exist.");
         }
-
-        file.canRead();
     }
 
     /**
@@ -264,6 +260,7 @@
      * @see java.awt.AWTPermission
      */
     public void open(File file) throws IOException {
+        file = new File(file.getPath());
         checkAWTPermission();
         checkExec();
         checkActionSupport(Action.OPEN);
@@ -295,6 +292,7 @@
      * @see java.awt.AWTPermission
      */
     public void edit(File file) throws IOException {
+        file = new File(file.getPath());
         checkAWTPermission();
         checkExec();
         checkActionSupport(Action.EDIT);
@@ -325,6 +323,7 @@
      * allowed to create a subprocess
      */
     public void print(File file) throws IOException {
+        file = new File(file.getPath());
         checkExec();
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {