On Tue, 22 Sep 2026 12:25:42 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> `Win32PrintService.Win32ServiceUIFactory.getUIClassNamesForRole()` 
> incorrectly creates a zero-length String array when handling 
> `DocumentPropertiesUI.DOCUMENTPROPERTIES_ROLE`, then writes the Document 
> Properties UI class name at index zero, so as
> a result, calling 
> `Win32PrintService.getServiceUIFactory().getUIClassNamesForRole(DocumentPropertiesUI.DOCUMENTPROPERTIES_ROLE)`
> throws `ArrayIndexOutOfBoundsException `instead of reporting the supported UI 
> class.
> 
> The fix returns a single-element array containing 
> `DocumentPropertiesUI.DOCPROPERTIESCLASSNAME`
> 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

test/jdk/javax/print/GetUIClassNameForRole.java line 54:

> 52:                                     DOCUMENT_PROPERTIES_ROLE);
> 53: 
> 54:             if (names == null || names.length != 1) {

Returning null is perfectly legal. Returning more than one is also perfectly 
legal.
I think this test should be re-worked to test the actual bug which was an 
AIOOBE.
It doesn't have to be windows-specific.
It just needs to call the API on the factory, if any and check it doesn't get 
the AIIOBE.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33009#discussion_r4074212623

Reply via email to