RFR: 8367384: The ICC_Profile class may throw exceptions during serialization
Sergey Bylokhov
serb at openjdk.org
Wed Sep 17 03:47:33 UTC 2025
On Tue, 16 Sep 2025 23:51:06 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> Additional checks were recently added to ICC_Profile (see [JDK-8347377](https://bugs.openjdk.org/browse/JDK-8347377)). As a result, objects previously stored as valid profiles may now throw an IllegalArgumentException during serialization. Discussion about serialization was started in https://github.com/openjdk/jdk/pull/23044 but it seems at the end non-serialization related check was [verified](https://github.com/openjdk/jdk/pull/23044/commits/a5201b5f353e8957a1274261372496768edbc7a2). =(
>
> The patch itself is simple, but I found that we do not have good test coverage in this area. So I added two tests to cover all possible variants specified by the serialization spec.
src/java.desktop/share/classes/java/awt/color/ICC_Profile.java line 1567:
> 1565: throw new InvalidObjectException("Invalid ICC Profile Data", e);
> 1566: }
> 1567: }
There is possibility for optimization here, because we do not actually need to read the "data" if "csName" is a valid constant for the standard profile. However, the spec does not seem to say anything about the optionality of the data field itself, only about the content of the data. So, I left this part unchanged.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27326#discussion_r2354216500
More information about the client-libs-dev
mailing list