RFR: 8367384: The ICC_Profile class may throw exceptions during serialization [v3]

Sergey Bylokhov serb at openjdk.org
Thu Sep 25 03:12:18 UTC 2025


On Thu, 25 Sep 2025 00:40:04 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> Sergey Bylokhov has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - Merge branch 'openjdk:master' into JDK-8367384
>>  - Add naming conventions used in test file names
>>  - sort catch
>>  - Update ValidateICCHeaderData.java
>>  - 8367384: The ICC_Profile class may throw exceptions during serialization
>
> test/jdk/java/awt/color/ICC_Profile/Serialization/SerializationSpecTest/SerializationSpecTest.java line 89:
> 
>> 87:             throw new RuntimeException("Test failed");
>> 88:         }
>> 89:     }
> 
> Suggestion:
> 
>     private static void test(String test, Class<?> expected, String msg) {
>         System.out.println("Testing: " + test);
>         System.out.println("Description: " + msg);
>         
>         String fileName = test + ".ser";
>         File file = new File(System.getProperty("test.src", "."), fileName);
>         Class<?> actual = null;
>         try (var fis = new FileInputStream(file);
>              var ois = new ObjectInputStream(fis))
>         {
>             ois.readObject();
>         } catch (Exception e) {
>             actual = e.getClass();
>         }
>         if (actual != expected) {
>             System.err.println("Test: " + test);
>             System.err.println("Expected: " + expected);
>             System.err.println("Actual: " + actual);
>             throw new RuntimeException("Test failed");
>         }
>         System.out.println("Test Case: " + test + " passed \n");
>     }

I am not sure I like it when the test outputs much information. When an error occurs, it prints the test case that was running at the time. I have added a comment explaining the filename notation used in the test.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27326#discussion_r2377564475


More information about the client-libs-dev mailing list