<AWT Dev> RFR: 8182043: Access to Windows Large Icons [v14]

Alexey Ivanov aivanov at openjdk.java.net
Wed May 26 19:45:13 UTC 2021

On Wed, 26 May 2021 17:40:44 GMT, Phil Race <prr at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java line 300:
>>> 298: 
>>> 299:         if(!f.exists()) {
>>> 300:             return null;
>> Shall it throw `FileNotFoundException` or `IllegalArgumentException` if the file doesn't exist?
>> It could more convenient to return `null` rather than catch an exception.
>> The space is missing between if and the opening parenthesis.
> It definitely should not be IAE. But FNFE is a reasonable idea.
> However it changes the usage since it is a checked exception.
> I'm on the fence and could go either way.

The older similar method, `getSystemIcon(File f)`, returns `null` if the file doesn't exist. It could make sense to preserve the behaviour from this point of view and not to make the user of the API handle FNFE; thus the new method could easily be used instead.


PR: https://git.openjdk.java.net/jdk/pull/2875

More information about the awt-dev mailing list