RFR: 8329098: Support "@1x" image naming convention as fallback [v2]

Lukasz Kostyra lkostyra at openjdk.org
Fri Oct 18 13:59:44 UTC 2024


On Wed, 16 Oct 2024 13:14:01 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> Lukasz Kostyra has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review fixes
>>   
>>   - Change exception message in loadAll() to include original resource
>>     path
>>   - Add a test case to ImageStorageTest checking if we load a correct
>>     resource when both <res> and <res>@1x are present
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/iio/ImageStorage.java line 385:
> 
>> 383:                         try {
>> 384:                             theStream = ImageTools.createInputStream(input);
>> 385:                         } catch (IOException ignored) {
> 
> It looks like this abstracts away errors like `FileNotFoundException`, and it will do a fallback in all cases, even if it is not a 404 or `FileNotFoundException` -- errors like network problems, permission problems, etc, will also trigger a fallback (likely resulting in the same error).  But it could also be a different error, hiding the original problem.
> 
> In Java we have the option to add a 'surpressed' exception.  You could attach it to the 2nd exception, so the original cause of the problem (which could be a permission problem for example) is not lost.
> 
> Maybe I'm being too picky :)

That is technically solved by re-calling `createInputStream(input)` like @mstr2 suggested to get a correct exception with valid message, so I will go with that approach.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1598#discussion_r1806534863


More information about the openjfx-dev mailing list