<AWT Dev> RFR: 7131400 [macosx] Desktop.edit(a directory) should throw IOException

Philip Race philip.race at oracle.com
Tue Mar 24 16:23:21 UTC 2020

One might consider what is happening on mac to be the preferred behaviour
for edit()
I am not sure I would consider this a bug to open finder on a folder.

How would you be able to achieve that after this change ?

Can't we open Explorer on Windows to align behaviour ?

The print() case it seems less useful - does that also open finder ?

Looking at the exception text for each case if we do go the route of
the current code :-

  442      * @throws IOException if the specified file has no associated
  443      * editor, or the associated application fails to be launched

I think it would be prudent to expand this text to be explicit about
this  directory case since you aren't failing to launch anything since the code
doesn't try and "no associated editor" is and of course that will need a CSR.

and for print then do the same :
478      * @throws IOException if the specified file has no associated
  479      * application that can be used to print it

maybe that should be done even if we still allow the edit() case.


On 3/23/20, 2:32 AM, Sergey Bylokhov wrote:
> Hello.
> Please review the fix for jdk/client.
> Bug: https://bugs.openjdk.java.net/browse/JDK-7131400
> Fix: http://cr.openjdk.java.net/~serb/7131400/webrev.00
> The java.awt.Desktop.edit()/print() methods behave differently
> on macOS and Windows when the folder is passed as a parameter.
> On Windows we throw IOException, and on macOS we open the folder using 
> Finder.
> This change aligns behavior and always throws an exception.
> On linux these methods are not implemented and throw 
> UnsupportedOperationException.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/awt-dev/attachments/20200324/77091ddd/attachment-0001.htm>

More information about the awt-dev mailing list