Program: 95160
Project: 95160
Buggy source:
public void run(){
  IChatRoomManager managers[]=new IChatRoomManager[accounts.size()];
  int j=0;
  for (Iterator i=accounts.values().iterator(); i.hasNext(); ) {
    UserAccount ua=(UserAccount)i.next();
    managers[j++]=ua.getContainer().getChatRoomManager();
  }
  ChatRoomSelectionDialog dialog=new ChatRoomSelectionDialog(RosterView.this.getViewSite().getShell(),managers);
  dialog.setBlockOnOpen(true);
  dialog.open();
  if (dialog.getReturnCode() != Window.OK) {
    return;
  }
  ChatRoomSelectionDialog.Room room=dialog.getSelectedRoom();
  IChatRoomManager selectedManager=room.getManager();
  IRoomInfo selectedInfo=room.getRoomInfo();
  if (room == null || selectedManager == null || selectedInfo == null) {
    MessageDialog.openInformation(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str");
    return;
  }
  String secondaryID=getChatRoomSecondaryID(selectedInfo.getRoomID());
  if (secondaryID == null) {
    MessageDialog.openError(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + selectedInfo.getRoomID());
    return;
  }
  IWorkbenchWindow ww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  IWorkbenchPage wp=ww.getActivePage();
  RoomWithAView roomView=getRoomView(secondaryID);
  if (roomView != null) {
    ChatRoomView view=roomView.getView();
    wp.activate(view);
    return;
  }
  IChatRoomContainer chatRoom=null;
  try {
    chatRoom=selectedManager.makeChatRoomContainer();
  }
 catch (  ContainerInstantiationException e1) {
    MessageDialog.openError(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str");
  }
  IChatMessageSender sender=chatRoom.getChatMessageSender();
  IViewPart view=null;
  try {
    IViewReference ref=wp.findViewReference(CHAT_ROOM_VIEW_CLASS,secondaryID);
    if (ref == null) {
      view=wp.showView(CHAT_ROOM_VIEW_CLASS,secondaryID,IWorkbenchPage.VIEW_ACTIVATE);
    }
 else {
      view=ref.getView(true);
    }
    final ChatRoomView chatroomview=(ChatRoomView)view;
    chatroomview.initialize(RosterView.this,secondaryID,chatRoom,selectedInfo,sender);
    chatRoom.addMessageListener(new IMessageListener(){
      public void handleMessage(      ID fromID,      ID toID,      Type type,      String subject,      String messageBody){
        chatroomview.handleMessage(fromID,toID,type,subject,messageBody);
      }
    }
);
    chatRoom.addChatParticipantListener(new IChatParticipantListener(){
      public void handlePresence(      ID fromID,      IPresence presence){
        chatroomview.handlePresence(fromID,presence);
      }
      public void joined(      ID user){
        chatroomview.handleJoin(user);
      }
      public void left(      ID user){
        chatroomview.handleLeave(user);
      }
    }
);
    chatRoom.addInvitationListener(new IInvitationListener(){
      public void handleInvitationReceived(      ID roomID,      ID from,      ID toID,      String subject,      String body){
        chatroomview.handleInvitationReceived(roomID,from,toID,subject,body);
      }
    }
);
  }
 catch (  PartInitException e) {
    UiPlugin.log("String_Node_Str" + selectedInfo.getRoomID(),e);
    MessageDialog.openError(getViewSite().getShell(),"String_Node_Str","String_Node_Str" + selectedInfo.getName() + "String_Node_Str");
    return;
  }
  try {
    chatRoom.connect(selectedInfo.getRoomID(),null);
  }
 catch (  ContainerConnectException e1) {
    UiPlugin.log("String_Node_Str" + selectedInfo.getRoomID(),e1);
    MessageDialog.openError(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + selectedInfo.getName() + "String_Node_Str"+ e1.getMessage());
    return;
  }
  addRoomView(new RoomWithAView(selectedManager,chatRoom,(ChatRoomView)view,secondaryID));
}

Fixed version (ground truth):
public void run(){
  IChatRoomManager managers[]=new IChatRoomManager[accounts.size()];
  int j=0;
  for (Iterator i=accounts.values().iterator(); i.hasNext(); ) {
    UserAccount ua=(UserAccount)i.next();
    managers[j++]=ua.getContainer().getChatRoomManager();
  }
  ChatRoomSelectionDialog dialog=new ChatRoomSelectionDialog(RosterView.this.getViewSite().getShell(),managers);
  dialog.setBlockOnOpen(true);
  dialog.open();
  if (dialog.getReturnCode() != Window.OK) {
    return;
  }
  ChatRoomSelectionDialog.Room room=dialog.getSelectedRoom();
  IChatRoomManager selectedManager=room.getManager();
  IRoomInfo selectedInfo=room.getRoomInfo();
  if (room == null || selectedManager == null || selectedInfo == null) {
    MessageDialog.openInformation(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str");
    return;
  }
  String secondaryID=getChatRoomSecondaryID(selectedInfo.getRoomID());
  if (secondaryID == null) {
    MessageDialog.openError(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + selectedInfo.getRoomID());
    return;
  }
  IWorkbenchWindow ww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  IWorkbenchPage wp=ww.getActivePage();
  RoomWithAView roomView=getRoomView(secondaryID);
  if (roomView != null) {
    ChatRoomView view=roomView.getView();
    wp.activate(view);
    return;
  }
  IChatRoomContainer chatRoom=null;
  try {
    chatRoom=selectedManager.makeChatRoomContainer();
  }
 catch (  ContainerInstantiationException e1) {
    MessageDialog.openError(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str");
  }
  IChatMessageSender sender=chatRoom.getChatMessageSender();
  IViewPart view=null;
  try {
    IViewReference ref=wp.findViewReference(CHAT_ROOM_VIEW_CLASS,secondaryID);
    if (ref == null) {
      view=wp.showView(CHAT_ROOM_VIEW_CLASS,secondaryID,IWorkbenchPage.VIEW_ACTIVATE);
    }
 else {
      view=ref.getView(true);
    }
    final ChatRoomView chatroomview=(ChatRoomView)view;
    chatroomview.initialize(RosterView.this,secondaryID,chatRoom,selectedInfo,sender);
    chatRoom.addMessageListener(new IMessageListener(){
      public void handleMessage(      ID fromID,      ID toID,      Type type,      String subject,      String messageBody){
        chatroomview.handleMessage(fromID,toID,type,subject,messageBody);
      }
    }
);
    chatRoom.addChatParticipantListener(new IChatParticipantListener(){
      public void handlePresence(      ID fromID,      IPresence presence){
        chatroomview.handlePresence(fromID,presence);
      }
      public void joined(      ID user){
        chatroomview.handleJoin(user);
      }
      public void left(      ID user){
        chatroomview.handleLeave(user);
      }
    }
);
    chatRoom.addInvitationListener(new IInvitationListener(){
      public void handleInvitationReceived(      ID roomID,      ID from,      ID toID,      String subject,      String body){
        chatroomview.handleInvitationReceived(roomID,from,toID,subject,body);
      }
    }
);
  }
 catch (  PartInitException e) {
    UiPlugin.log("String_Node_Str" + selectedInfo.getRoomID(),e);
    MessageDialog.openError(getViewSite().getShell(),"String_Node_Str","String_Node_Str" + selectedInfo.getName() + "String_Node_Str");
    return;
  }
  try {
    chatRoom.connect(selectedInfo.getRoomID(),getChatJoinContext("String_Node_Str" + selectedInfo.getName()));
  }
 catch (  ContainerConnectException e1) {
    UiPlugin.log("String_Node_Str" + selectedInfo.getRoomID(),e1);
    MessageDialog.openError(RosterView.this.getViewSite().getShell(),"String_Node_Str","String_Node_Str" + selectedInfo.getName() + "String_Node_Str"+ e1.getMessage());
    return;
  }
  addRoomView(new RoomWithAView(selectedManager,chatRoom,(ChatRoomView)view,secondaryID));
}