--- old/src/java.desktop/share/classes/java/awt/Desktop.java 2020-03-22 22:10:54.278453700 -0700 +++ new/src/java.desktop/share/classes/java/awt/Desktop.java 2020-03-22 22:10:53.865360700 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2020, 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 @@ -458,7 +458,9 @@ checkActionSupport(Action.EDIT); file.canWrite(); checkFileValidation(file); - + if (file.isDirectory()) { + throw new IOException(file.getPath() + " is a directory"); + } peer.edit(file); } @@ -491,7 +493,9 @@ } checkActionSupport(Action.PRINT); checkFileValidation(file); - + if (file.isDirectory()) { + throw new IOException(file.getPath() + " is a directory"); + } peer.print(file); }