RFR: JDK-8346465 : Add a check in setData() to restrict the update of Built-In ICC_Profiles [v11]
Harshitha Onkar
honkar at openjdk.org
Wed Mar 12 21:11:54 UTC 2025
On Wed, 12 Mar 2025 19:30:17 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>>> The System Properties case isn't something I'd want to follow. It doesn't really make them read-only.
>>> It just ensures that the JDK internally caches the original value for use in certain places.
>>
>> Right. The application may attempt to change these java properties, but it won't affect the behavior of the JDK since the JDK internally will use the initially cached value of the property via StaticProperty.userDir()/userHome()/etc.
>>
>> This is even specified similarly to what we want for color profiles.
>>
>>> * <strong>Changing a standard system property may have unpredictable results
>> * unless otherwise specified.</strong>
>> * Property values may be cached during initialization or on first use.
>> * Setting a standard property after initialization using {@link #getProperties()},
>> * {@link #setProperties(Properties)}, {@link #setProperty(String, String)}, or
>> * {@link #clearProperty(String)} may not have the desired effect.
>
> * Builtin color profiles may be cached during initialization or on first use. Changing a standard profiles after initialization using ICC_Profile.setData may not have the desired effect.
> > Since there is no way to check if a profile is built-in, making built-in profiles read-only might be a better approach, similar to [java properties](https://bugs.openjdk.org/browse/JDK-8066709).
>
> But it also has its own disadvantages...
@mrserb You mentioned earlier that there are disadvantages of using java properties approach, so using builtIn flag would be better then, correct?
> I remember we discussed this issue during the review of [this commit](https://github.com/openjdk/jdk/pull/3037/files#diff-3dd53a33889801159f43dbb990ba033066bdabaed71bbc7254f58331d3898d69R39), and the conclusion was that it was too late to change it and break apps.
I wasn't able to find the previous discussion thread so I'm not sure what are the disadvantages. Can you please explain?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23606#discussion_r1992295739
More information about the client-libs-dev
mailing list