On Tue, 28 Jan 2025 02:08:18 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:
>>>Is this question applicable only for Rendering Intent or other fields too? >> >> For other fields too. Note, before this fix the following method iccCStoJCS >> was used to convert icc constant to java constant and if it was not possible >> an exception was thrown. One of the reasons it was not possible is because >> we do not cover all variants as java constants so we cannot return anything >> useful from getPCSType/etc, but it was still possible to use such profiles >> for color conversion. >> >> This patch starts using iccCStoJCS as the source of truth. I'm not sure if >> this is correct or not. We can double-check that it covers all valid cases, >> so we can reject everything else. >> >> But the existing checks that are already in the constructor can be safely >> added. > >>Note, before this fix the following method iccCStoJCS was used to convert icc >>constant to java constant and if it was not possible an exception was thrown. > > Agreed. > >> but it was still possible to use such profiles for color conversion. > > The exception that I mentioned here: > https://github.com/openjdk/jdk/pull/23044#discussion_r1929879100 is WITHOUT > the newly added validation checks in setData(). > > The test case for that I used is as follows > > > ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB); > ICC_Profile sRGB = ICC_Profile.getInstace(ColorSpace.CS_sRGB); > sRGB.setData() // changed the color space to cmsSigMCH1Data which is not in > JDK and commented out the validation checks in setData() > cs.toRGB(new float[3]); //color transform from CS_LINEAR_RGB to CS_sRGB fails > But the existing checks that are already in the constructor can be safely > added. So profile class and color space validation checks should be okay to add to .setData() ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23044#discussion_r1931430373