> This PR simplifies several aspects of the ICC_Profile class: > > - [Change > 1](https://github.com/openjdk/jdk/pull/25650/commits/426a608b1df9e39e221d05e7374a3fecf6e6cf30): > The ICC_Profile.getInstance(byte[] data) method used to copy the profile > header for validation. This copy appears redundant, as the original data > array is used later anyway. This logic was originally introduced by > [JDK-8347377](https://bugs.openjdk.org/browse/JDK-8347377). > > - [Change > 2](https://github.com/openjdk/jdk/pull/25650/commits/4035c8b1f7e1dcbc9941ead939218bba47b0a2fe): > In some places, the code retrieves the profile header using > getData(icSigHead), which always creates a new array. It is now replaced with > private getData(cmmProfile(), icSigHead) to avoid unnecessary copying. To > clarify the purpose of the private method, I have added documentation. > > - [Change > 3](https://github.com/openjdk/jdk/pull/25650/commits/96ad456593de3dd68c3ae6840fffee7bac68bc0c): > After Change 2, static analysis tools began reporting a potential NPE when > using getData(cmmProfile(), icSigHead), since it may return null. To address > this, the internal implementation of getData was updated to always return a > non-null value or throw an exception. The public method now catches this > exception and returns null, as required by the specification. **Note**: this > potential NPE is not a regression introduced by any changes, it simply became > easier for tools to detect due to the simplified code. > > @prrace @honkar-jdk please take a look
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 eight additional commits since the last revision: - Merge branch 'openjdk:master' into JDK-8358623 - theHeader -> data - Update CheckVersions.java - Create CheckVersions.java - ICC -> CMM - Eliminate possible NPE when getData is used - Replace getData(icSigHead) by the getData(cmmProfile(), icSigHead) - Avoid arraycopy in getInstance(byte[]) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/25650/files - new: https://git.openjdk.org/jdk/pull/25650/files/97d01fc3..ec1165d8 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=25650&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25650&range=01-02 Stats: 51198 lines in 1483 files changed: 30467 ins; 13841 del; 6890 mod Patch: https://git.openjdk.org/jdk/pull/25650.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/25650/head:pull/25650 PR: https://git.openjdk.org/jdk/pull/25650