This PR fixes a bug in `CachedRowSet` when insertion into a table with more primary key columns than columns selected by the row set causes `ArrayIndexOutOfBoundsException`.
This occurs because the code erroneously allocates the `primaryKeys` array to size `icolCount`. So if there are more pks than cols selected, the code will naturally index an out of bounds index in the array. Instead, the code should use an `ArrayList` because the count of the pks is not yet known. This is also hinted at considering the previous code was incrementing a `k` to figure out the key size. We can also process the primary keys such that they are only built once instead of building them for every single row for a given `writeData` op. --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - init Changes: https://git.openjdk.org/jdk/pull/33350/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=33350&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8394152 Stats: 175 lines in 2 files changed: 161 ins; 10 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/33350.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/33350/head:pull/33350 PR: https://git.openjdk.org/jdk/pull/33350
