Index: src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUITest.java =================================================================== --- src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUITest.java (revision 494496) +++ src/test/api/java/common/javax/swing/plaf/basic/BasicOptionPaneUITest.java (working copy) @@ -539,6 +539,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, @@ -570,6 +572,13 @@ .getIconForType(JOptionPane.QUESTION_MESSAGE)); assertSame("icons are shared", icon42, paneUI .getIconForType(JOptionPane.WARNING_MESSAGE)); + // Regression test for HARMONY-2903 + try { + new BasicOptionPaneUI().getIconForType(0); + fail("NullPointerException should have been thrown"); + } catch (NullPointerException e) { + // Expected + } } public void testGetMaxCharactersPerLineCount() {