Index: src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUITest.java =================================================================== --- src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUITest.java (revision 496381) +++ src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUITest.java (working copy) @@ -545,6 +545,8 @@ } public void testGetIconForType() throws InterruptedException { + paneUI.optionPane = new JOptionPane(); + paneUI.optionPane.setUI(paneUI); Icon icon11 = new IconUIResource(new ImageIcon(new BufferedImage(10, 20, BufferedImage.TYPE_INT_RGB))); Icon icon21 = new IconUIResource(new ImageIcon(new BufferedImage(30, 40, @@ -578,6 +580,15 @@ .getIconForType(JOptionPane.WARNING_MESSAGE)); } + public void testGetIconForType_Null() throws InterruptedException { + try { // Regression test for HARMONY-2903 + new BasicOptionPaneUI().getIconForType(0); + fail("NullPointerException should have been thrown"); + } catch (NullPointerException e) { + // Expected + } + } + public void testGetMaxCharactersPerLineCount() { paneUI.optionPane = new JOptionPane(); paneUI.optionPane.setUI(paneUI);