RFR: 8293971: Loading new Media from resources can sometimes fail when loading from FXML [v2]

Alexander Matveev almatvee at openjdk.org
Tue Sep 27 01:22:42 UTC 2022


On Mon, 26 Sep 2022 15:16:34 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Alexander Matveev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8293971: Loading new Media from resources can sometimes fail when loading from FXML [v2]
>
> modules/javafx.media/src/main/java/com/sun/media/jfxmedia/locator/Locator.java line 425:
> 
>> 423:                             stream.close();
>> 424:                             isConnected = true;
>> 425:                             contentType = MediaUtils.filenameToContentType(uri); // We need to provide at least something
> 
> would it be possible to explain what ie being done instead?  i.e. "try to determine the content type based on extension" or something like that?

Fixed.

> modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/MediaUtils.java line 187:
> 
>> 185:      * Returns the content type given the file name.
>> 186:      *
>> 187:      * @param uri
> 
> should the comment be changed since the argument is uri and not a file name?

Fixed.

> modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/MediaUtils.java line 241:
> 
>> 239: 
>> 240:         String scheme = uri.getScheme().toLowerCase();
>> 241:         if (scheme.equals("jar")) {
> 
> is it possible for the 'scheme' to be null?
> 
> (may be "jar".equals(scheme) would work better here?)

No, it should not be null, since we have check for null before it. I did change it, so it is same as rest of our code.

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

PR: https://git.openjdk.org/jfx/pull/902


More information about the openjfx-dev mailing list