Print

Print


Hello!

If TabbedInspector.clear() is called JtabbedPane.removeAll() will set 
the selected index to -1. The change event fired thereafter will lead to 
an ArrayIndexOutOfBoundsException in 
TabbedInspector.updateDisplayedInspector() because there is no check for 
invalid indices and the tab count is still > 0.

Tested with mason revision 1010 and OpenJDK version "1.7.0_75".

Best regards,
Christian

import sim.portrayal.Inspector;
import sim.portrayal.inspector.TabbedInspector;

public class TestTabbedInspector {
     public static void main(String[] args) {
	TabbedInspector tabbedInspector = new TabbedInspector();

	Inspector blankInspector = new Inspector() {
	    private static final long serialVersionUID = 1L;

	    @Override
	    public void updateInspector() {
	    }
	};

	tabbedInspector.addInspector(blankInspector);
	tabbedInspector.clear();
     }
}