MASON-INTEREST-L Archives

February 2015

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type:
text/plain; charset=utf-8; format=flowed
Date:
Thu, 5 Feb 2015 17:12:58 +0100
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
MIME-Version:
1.0
Message-ID:
Content-Transfer-Encoding:
7bit
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
From:
Christian Meyer <[log in to unmask]>
Parts/Attachments:
text/plain (33 lines)
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();
     }
}

ATOM RSS1 RSS2