On Thu, 23 Jul 2026 21:41:20 GMT, Justin Lu <[email protected]> wrote:

> Ensure that the implementation does not generate subsequent warnings for each 
> row exceeded above the maximum allowed. 
> 
> Additional fixes included
> - `crs` created via hashtable c-tor no longer throws `NPE` when its warning 
> is referenced.
> - 2-arg `populate` uses `setWarning` with a `RowSetWarning` which fixes the 
> issue when the warning was polled by client and an `Error` occurred, because 
> `setException` does not expect an `SQLException`
> - Root warning is no longer a pointless blank warning. The root warning now 
> always contains a valid warning message.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java line 387:

> 385: 
> 386:         // set the warnings
> 387:         sqlwarn = new SQLWarning();

`sqlwarn` does not get a `addRowSetWarning` style method because it is unused 
by the implementation.

src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java line 
6818:

> 6816:     private void addRowSetWarning(String reason) {
> 6817:         if (rowsetWarning == null) {
> 6818:             rowsetWarning = new RowSetWarning(reason);

Although I consider it a bug that the root warning was always empty in the 
original code, I can revert this change to the original behavior if we think 
there is risk.

src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java line 
7337:

> 7335:           if(pageSize == 0){
> 7336:             if (rowsFetched >= mRows && mRows > 0) {
> 7337:                 addRowSetWarning(MAX_ROW_WARNING);

`exceededMax` is not required for the 2-arg `populate` because the existing 
code already breaks out of processing altogether when the max is encountered.

test/jdk/javax/sql/test/rowset/cachedrowset/CachedRowSetWarningsTest.java line 
1:

> 1: /*

Added these warning tests as a standalone test file, since 
`test/jdk/javax/sql/test/rowset/cachedrowset/CachedRowSetTests.java` is better 
reserved for the common test suite.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32033#discussion_r3641567427
PR Review Comment: https://git.openjdk.org/jdk/pull/32033#discussion_r3641593267
PR Review Comment: https://git.openjdk.org/jdk/pull/32033#discussion_r3641572110
PR Review Comment: https://git.openjdk.org/jdk/pull/32033#discussion_r3641584500

Reply via email to