Mercurial > hg > openjdk > jdk6 > jdk
changeset 1819:015385190f06
8191239: Improve desktop file usage
Reviewed-by: prr, rhalade, aghaisas
author | serb |
---|---|
date | Thu, 01 Feb 2018 20:19:42 -0800 |
parents | 9583b6a8e412 |
children | 81fa2439e257 |
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 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) {