Program: 94656
Project: 94656
Buggy source:
ChatRoomTab(boolean withParticipantsList,CTabFolder parent,String name,KeyListener keyListener){
  withParticipants=withParticipantsList;
  tabItem=new CTabItem(parent,SWT.NULL);
  tabItem.setText(name);
  if (withParticipants) {
    fullChat=new SashForm(parent,SWT.HORIZONTAL);
    fullChat.setLayout(new FillLayout());
    Composite memberComp=new Composite(fullChat,SWT.NONE);
    GridLayout layout=new GridLayout(1,true);
    layout.marginWidth=0;
    layout.marginHeight=0;
    memberComp.setLayout(layout);
    participantsNumberLabel=new Label(memberComp,SWT.BORDER | SWT.READ_ONLY);
    participantsNumberLabel.setLayoutData(new GridData(SWT.FILL,SWT.BEGINNING,true,false));
    participantsNumberLabel.setAlignment(SWT.CENTER);
    participantsTable=new TableViewer(memberComp,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI);
    participantsTable.setSorter(new ViewerSorter());
    participantsTable.getTable().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    participantsTable.addOpenListener(new IOpenListener(){
      public void open(      OpenEvent event){
        IStructuredSelection selection=(IStructuredSelection)event.getSelection();
        String user=((ChatRoomParticipant)selection.getFirstElement()).getName();
        if (!ChatRoomManagerView.this.localUserName.equals(user)) {
          try {
            MessagesView messagesView=getMessagesView();
            messagesView.selectTab(container.getPrivateMessageSender(),null,createStringID(localUserName),createStringID(user));
            getSite().getPage().activate(messagesView);
          }
 catch (          PartInitException e) {
            Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,IStatus.ERROR,NLS.bind(Messages.ChatRoomManagerView_EXCEPTION_MESSAGE_VIEW_INITIALIZATION,user),e));
          }
        }
      }
    }
);
    Composite rightComp=new Composite(fullChat,SWT.NONE);
    rightComp.setLayout(layout);
    subjectText=createStyledTextWidget(rightComp,SWT.SINGLE | SWT.BORDER);
    subjectText.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
    subjectText.addKeyListener(new KeyAdapter(){
      public void keyPressed(      KeyEvent evt){
        if (evt.character == SWT.CR || evt.character == SWT.KEYPAD_CR) {
          ChatRoom chatroom=(ChatRoom)chatRooms.get(tabItem.getText());
          if (chatroom != null) {
            IChatRoomAdminSender chatRoomAdminSender=chatroom.chatRoomContainer.getChatRoomAdminSender();
            try {
              if (chatRoomAdminSender != null) {
                chatRoomAdminSender.sendSubjectChange(subjectText.getText());
              }
            }
 catch (            ECFException e) {
              disconnected();
            }
          }
        }
      }
    }
);
    rightSash=new SashForm(rightComp,SWT.VERTICAL);
    rightSash.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  }
 else   rightSash=new SashForm(parent,SWT.VERTICAL);
  outputText=createStyledTextWidget(rightSash,SWT.BORDER | SWT.WRAP | SWT.V_SCROLL| SWT.MULTI| SWT.READ_ONLY);
  outputText.setEditable(false);
  outputText.setLayoutData(new GridData(GridData.FILL_BOTH));
  inputText=new Text(rightSash,SWT.BORDER | SWT.MULTI | SWT.WRAP| SWT.V_SCROLL);
  if (keyListener != null)   inputText.addKeyListener(keyListener);
  rightSash.setWeights(new int[]{RATIO_READ_PANE,RATIO_WRITE_PANE});
  if (withParticipants) {
    fullChat.setWeights(new int[]{RATIO_PRESENCE_PANE,RATIO_READ_WRITE_PANE});
    tabItem.setControl(fullChat);
  }
 else   tabItem.setControl(rightSash);
  parent.setSelection(tabItem);
  makeActions();
  hookContextMenu();
  if (withParticipants) {
    hookParticipantsContextMenu();
  }
  StyledText st=getOutputText();
  if (st != null) {
    ScrollBar vsb=st.getVerticalBar();
    if (vsb != null) {
      vsb.addSelectionListener(scrollSelectionListener);
      vsb.addDisposeListener(new DisposeListener(){
        public void widgetDisposed(        DisposeEvent e){
          StyledText ot=getOutputText();
          if (ot != null) {
            ScrollBar sb=ot.getVerticalBar();
            if (sb != null)             sb.removeSelectionListener(scrollSelectionListener);
          }
        }
      }
);
    }
  }
}

Fixed version (ground truth):
ChatRoomTab(boolean withParticipantsList,CTabFolder parent,String name,KeyListener keyListener){
  withParticipants=withParticipantsList;
  tabItem=new CTabItem(parent,SWT.NULL);
  tabItem.setText(name);
  if (withParticipants) {
    fullChat=new SashForm(parent,SWT.HORIZONTAL);
    fullChat.setLayout(new FillLayout());
    Composite memberComp=new Composite(fullChat,SWT.NONE);
    GridLayout layout=new GridLayout(1,true);
    layout.marginWidth=0;
    layout.marginHeight=0;
    memberComp.setLayout(layout);
    participantsNumberLabel=new Label(memberComp,SWT.BORDER | SWT.READ_ONLY);
    participantsNumberLabel.setLayoutData(new GridData(SWT.FILL,SWT.BEGINNING,true,false));
    participantsNumberLabel.setAlignment(SWT.CENTER);
    participantsTable=new TableViewer(memberComp,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI);
    participantsTable.setSorter(new ViewerSorter());
    participantsTable.getTable().setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
    participantsTable.addOpenListener(new IOpenListener(){
      public void open(      OpenEvent event){
        IStructuredSelection selection=(IStructuredSelection)event.getSelection();
        String user=((ChatRoomParticipant)selection.getFirstElement()).getName();
        if (!ChatRoomManagerView.this.localUserName.equals(user)) {
          try {
            MessagesView messagesView=getMessagesView();
            messagesView.selectTab(container.getPrivateMessageSender(),null,createStringID(localUserName),createStringID(user));
            getSite().getPage().activate(messagesView);
          }
 catch (          PartInitException e) {
            Activator.getDefault().getLog().log(new Status(IStatus.ERROR,Activator.PLUGIN_ID,IStatus.ERROR,NLS.bind(Messages.ChatRoomManagerView_EXCEPTION_MESSAGE_VIEW_INITIALIZATION,user),e));
          }
        }
      }
    }
);
    Composite rightComp=new Composite(fullChat,SWT.NONE);
    rightComp.setLayout(layout);
    subjectText=createStyledTextWidget(rightComp,SWT.SINGLE | SWT.BORDER);
    subjectText.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
    subjectText.setEditable(false);
    subjectText.setEnabled(false);
    rightSash=new SashForm(rightComp,SWT.VERTICAL);
    rightSash.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
  }
 else   rightSash=new SashForm(parent,SWT.VERTICAL);
  outputText=createStyledTextWidget(rightSash,SWT.BORDER | SWT.WRAP | SWT.V_SCROLL| SWT.MULTI| SWT.READ_ONLY);
  outputText.setEditable(false);
  outputText.setLayoutData(new GridData(GridData.FILL_BOTH));
  inputText=new Text(rightSash,SWT.BORDER | SWT.MULTI | SWT.WRAP| SWT.V_SCROLL);
  if (keyListener != null)   inputText.addKeyListener(keyListener);
  rightSash.setWeights(new int[]{RATIO_READ_PANE,RATIO_WRITE_PANE});
  if (withParticipants) {
    fullChat.setWeights(new int[]{RATIO_PRESENCE_PANE,RATIO_READ_WRITE_PANE});
    tabItem.setControl(fullChat);
  }
 else   tabItem.setControl(rightSash);
  parent.setSelection(tabItem);
  makeActions();
  hookContextMenu();
  if (withParticipants) {
    hookParticipantsContextMenu();
  }
  StyledText st=getOutputText();
  if (st != null) {
    ScrollBar vsb=st.getVerticalBar();
    if (vsb != null) {
      vsb.addSelectionListener(scrollSelectionListener);
      vsb.addDisposeListener(new DisposeListener(){
        public void widgetDisposed(        DisposeEvent e){
          StyledText ot=getOutputText();
          if (ot != null) {
            ScrollBar sb=ot.getVerticalBar();
            if (sb != null)             sb.removeSelectionListener(scrollSelectionListener);
          }
        }
      }
);
    }
  }
}