Buggy code:
public TreeGroup ( ID svcID , String name ) { } public int getActiveCount ( ) { } public int getTotalCount ( ) { } public ID getServiceID ( ) { } } class TreeBuddy extends RosterView . TreeParent { IPresence presence = null ; ID svcID = null ; public TreeBuddy ( ID svcID , String name , ID id , IPresence p ) { } public IPresence getPresence ( ) { } public void setPresence ( IPresence p ) { } public ID getServiceID ( ) { } public boolean isActive ( ) { } } class ViewContentProvider implements IStructuredContentProvider , ITreeContentProvider { private RosterView . TreeParent invisibleRoot ; private RosterView . TreeParent root ; public void inputChanged ( Viewer v , Object oldInput , Object newInput ) { } public void dispose ( ) { } public RosterView . TreeBuddy findBuddyWithUserID ( ID userID ) { } public Object [ ] getElements ( Object parent ) { } public Object getParent ( Object child ) { } public Object [ ] getChildren ( Object parent ) { } public boolean hasChildren ( Object parent ) { } public RosterView . TreeBuddy fillPresence ( RosterView . TreeBuddy obj , IPresence presence ) { } public RosterView . TreeBuddy createBuddy ( RosterView . TreeBuddy oldBuddy , IRosterEntry entry ) { } public RosterView . TreeGroup findGroup ( RosterView . TreeParent parent , String name ) { } public String [ ] getAllGroupNames ( ) { } public RosterView . TreeBuddy findBuddy ( RosterView . TreeParent parent , IRosterEntry entry ) { } public RosterView . TreeBuddy findBuddy ( RosterView . TreeParent parent , ID entryID ) { } public void addEntry ( RosterView . TreeParent parent , IRosterEntry entry ) { } public void replaceEntry ( RosterView . TreeParent parent , IRosterEntry entry ) { } public void addGroup ( ID svcID , String name ) { } public void addGroup ( ID svcID , RosterView . TreeParent parent , String name ) { } public void removeGroup ( RosterView . TreeParent parent , String name ) { } public void removeGroup ( String name ) { } public void addEntry ( IRosterEntry entry ) { } public void replaceEntry ( IRosterEntry entry ) { } public void removeRosterEntry ( ID entry ) { } public void removeEntry ( RosterView . TreeParent parent , ID entry ) { } protected void removeChildren ( RosterView . TreeParent parent , ID svcID ) { } public void removeAllEntriesForAccount ( RosterView . UserAccount account ) { } private void initialize ( ) { } } class ViewLabelProvider extends LabelProvider { public String getText ( Object obj ) { } public Image getImage ( Object obj ) { } } class NameSorter extends ViewerSorter { } public RosterView ( ) { } protected void refreshView ( ) { } protected void expandAll ( ) { } public void createPartControl ( Composite parent ) { } private void hookContextMenu ( ) { } private void contributeToActionBars ( ) { } private void fillLocalPullDown ( IMenuManager manager ) { } private void fillContextMenu ( IMenuManager manager ) { } protected void openDialogAndSendRequest ( ID svcID , String name , String groupName ) { } protected void requestAuthFrom ( RosterView . TreeBuddy buddy , RosterView . TreeGroup tg ) { } protected void addUserToGroup ( ID serviceID , String groupName ) { } protected void removeUserFromGroup ( RosterView . TreeBuddy buddy , RosterView . TreeGroup group ) { } protected RosterView . TreeObject getSelectedTreeObject ( ) { } private void fillLocalToolBar ( IToolBarManager manager ) { } protected ID inputIMTarget ( ) { } class RoomWithAView { IChatRoomContainer container ; ChatRoomView view ; String secondaryID ; IChatRoomManager manager ; RoomWithAView ( IChatRoomManager manager , IChatRoomContainer container , ChatRoomView view , String secondaryID ) { } public IChatRoomManager getManager ( ) { } public IChatRoomContainer getContainer ( ) { } public ChatRoomView getView ( ) { } public String getID ( ) { } } private String getChatRoomSecondaryID ( ID roomID ) { } private void makeActions ( ) { } protected void addRoomView ( RosterView . RoomWithAView roomView ) { } protected void removeRoomView ( RosterView . RoomWithAView roomView ) { <START_BUG> chatRooms . remove ( roomView ) ; <END_BUG> } protected RosterView . RoomWithAView getRoomView ( String id ) { } protected ChatWindow openChatWindowForTarget ( ID targetID ) { } protected ChatWindow makeChatWindowForTarget ( ID targetID ) { } private void hookDoubleClickAction ( ) { } public void setFocus ( ) { } public void handleRosterEntry ( ID groupID , IRosterEntry entry ) { } public void handlePresence ( ID groupID , ID userID , IPresence presence ) { } protected RosterView . UserAccount getAccountForUser ( ID userID ) { } protected ILocalInputHandler getHandlerForUser ( ID userID ) { } public Object getAdapter ( Class clazz ) { } protected String getWindowInitText ( ID targetID ) { } protected String getDateAndTime ( ) { } public void handleMessage ( ID groupID , ID fromID , ID toID , IMessageListener . Type type , String subject , String message ) { } public void addAccount ( ID account , IUser user , ILocalInputHandler handler , IPresenceContainer container ) { } protected void setToolbarEnabled ( boolean enabled ) { } public void accountDeparted ( ID serviceID ) { } protected void disposeAllChatWindowsForAccount ( RosterView . UserAccount account , String status ) { } protected void removeAllRosterEntriesForAccount ( RosterView . UserAccount account ) { } public String [ ] getGroupNames ( ) { } public String getSelectedGroupName ( ) { } public void addGroup ( ID svcID , String name ) { } public void removeGroup ( String name ) { } public void removeRosterEntry ( ID id ) { } protected void handleAccountDeparted ( RosterView . UserAccount account ) { } public void handleSetRosterEntry ( ID groupID , IRosterEntry entry ) { } public void chatRoomViewClosing ( String secondaryID ) { } }

Fix:
chatRooms . remove ( roomView . getID ( ) ) ;