# HG changeset patch # User serb # Date 1517545182 28800 # Node ID 015385190f068e48d8e2466c0ffcac2f22050175 # Parent 9583b6a8e41210bedd94d5ea1590d2b20c57743b 8191239: Improve desktop file usage Reviewed-by: prr, rhalade, aghaisas diff -r 9583b6a8e412 -r 015385190f06 src/share/classes/java/awt/Desktop.java --- a/src/share/classes/java/awt/Desktop.java Fri Jun 08 07:54:59 2018 -0700 +++ 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) {