8068301: [TEST_BUG] Test javax/swing/JColorChooser/Test4177735.java fails with ArrayIndexOutOfBoundsException with GTKL&F
Reviewed-by: alexsch, azvegint
Contributed-by: shobhit.s.gupta@oracle.com
--- a/jdk/test/javax/swing/JColorChooser/Test4177735.java Thu Jan 29 09:34:05 2015 -0800
+++ b/jdk/test/javax/swing/JColorChooser/Test4177735.java Fri Jan 30 13:27:33 2015 +0300
@@ -38,9 +38,20 @@
private static final long DELAY = 1000L;
public static void main(String[] args) throws Exception {
+ int hsvIndex = 0;
+ int panelsLength;
+ int finalIndex;
JColorChooser chooser = new JColorChooser();
AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
- chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });
+ panelsLength = panels.length;
+
+ for(int i = 0; i < panelsLength; i++) {
+ if(panels[i].getDisplayName().equals("HSV")) {
+ hsvIndex = i;
+ }
+ }
+ finalIndex = Math.min(hsvIndex, panelsLength - 1);
+ chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[finalIndex] });
JDialog dialog = show(chooser);
pause(DELAY);