RFR: 8267551: Support loading images from inline data-URIs [v13]

Michael Strauß mstrauss at openjdk.java.net
Sat Jun 5 15:10:59 UTC 2021


On Fri, 4 Jun 2021 22:03:26 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> Michael Strauß has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 15 commits:
>> 
>>  - Merge branch 'master' into feature/image-datauri
>>    
>>    # Conflicts:
>>    #	modules/javafx.graphics/src/test/java/test/com/sun/javafx/iio/ImageStorageTest.java
>>  - Accept regular file paths, change javadoc
>>  - Merge branch 'openjdk:master' into feature/image-datauri
>>  - Rename DataURI.isValidURI
>>  - Reverted a change
>>  - Allow leading and trailing whitespace in data URI
>>  - Removed test
>>  - Changed data URI detection
>>  - Merge branch 'master' into feature/image-datauri
>>  - Moved test
>>  - ... and 5 more: https://git.openjdk.java.net/jfx/compare/7b7050c4...315523c5
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/util/DataURI.java line 175:
> 
>> 173: 
>> 174:     public byte[] getData() {
>> 175:         return data;
> 
> This returns a reference to the byte array rather than a copy. Is this what is wanted? If so, it would be good to add a comment.

I added a comment that clarifies this.

> modules/javafx.graphics/src/main/java/com/sun/javafx/util/DataURI.java line 185:
> 
>> 183: 
>> 184:         return originalUri.substring(0, originalUri.length() - originalData.length())
>> 185:             + originalData.substring(0, 14) + "..." + originalData.substring(originalData.length() - 14);
> 
> Why truncate it?

The idea was to not clutter logs with large pieces of data. Do you think that the entire data string should be logged?

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

PR: https://git.openjdk.java.net/jfx/pull/508


More information about the openjfx-dev mailing list