RFR: JDK-8346465 : Add a check in setData() to restrict the update of Built-In ICC_Profiles [v11]
Harshitha Onkar
honkar at openjdk.org
Thu Mar 20 21:05:12 UTC 2025
On Thu, 20 Mar 2025 19:50:25 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> @mrserb
>>
>>> The app may obtain a profile from some place and use it for some images or pixels. Then, if the app wants to tweak the rendering intent for some reason, what should it do?
>>>
>>> Clone the profile and then change the intent?
>>
>> The app would follow the above approach.
>> There is only one step extra with this fix - creating a copy of built-in profile and then modifying it.
>>
>>
>> byte[] builtInData = ICC_Profile.getInstance(ColorSpace.CS_sRGB).getData(); // get the byte array representation of BuiltIn- profile
>> ICCProfile newProfile = ICC_Profile.getInstance(builtInData) // create a new profile
>> newProfile.setData(...)
>>
>>
>>
>>> However, for older applications, these two solutions lead to different outcomes:
>>> Throwing the new exception will most likely break the application
>>
>> The chances of breaking an existing application is minimal since API usage for setData() was checked and not many were found and moreover they were not called on built-in profiles.
>>
>>
>>>Ignoring the data change allows the application to continue working, but the color conversion result may not be fully accurate
>>
>> This does not seem viable option because the user in unaware as to whether setData() worked or not.
>
> ok, it might be useful to mention this in the release notes.
Sure. Noted. I'll update the release notes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23606#discussion_r2006449828
More information about the client-libs-dev
mailing list