Program: 103269
Project: 103269
Buggy source:
/** 
 * Initializes this chat room dialog.
 */
private void init(){
  this.getContentPane().setLayout(new BorderLayout(5,5));
  JPanel northPanel=new TransparentPanel(new BorderLayout(5,5));
  northPanel.setBorder(BorderFactory.createEmptyBorder(15,15,5,15));
  JPanel labels=new TransparentPanel(new GridLayout(2,2,5,5));
  labels.add(new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str")));
  labels.add(new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str")));
  JPanel valuesPanel=new TransparentPanel(new GridLayout(2,2,5,5));
  providersCombo=createProvidersCombobox();
  roomsCombo=new JComboBox();
  roomsCombo.setEditable(true);
  roomsCombo.setPreferredSize(providersCombo.getPreferredSize());
  editor=((JTextField)roomsCombo.getEditor().getEditorComponent());
  providersCombo.addItemListener(new ItemListener(){
    public void itemStateChanged(    ItemEvent e){
      if (e.getStateChange() == ItemEvent.SELECTED)       loadProviderRooms();
    }
  }
);
  valuesPanel.add(providersCombo);
  valuesPanel.add(roomsCombo);
  northPanel.add(labels,BorderLayout.WEST);
  northPanel.add(valuesPanel,BorderLayout.CENTER);
  JPanel buttonPanel=new TransparentPanel(new BorderLayout(5,5));
  buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,15,10,15));
  JPanel westButtonPanel=new TransparentPanel();
  JPanel eastButtonPanel=new TransparentPanel();
  addButton.addActionListener(this);
  removeButton.addActionListener(this);
  okButton.addActionListener(this);
  cancelButton.addActionListener(this);
  addButton.setEnabled(false);
  removeButton.setEnabled(false);
  westButtonPanel.add(addButton);
  westButtonPanel.add(removeButton);
  eastButtonPanel.add(cancelButton);
  eastButtonPanel.add(okButton);
  buttonPanel.add(westButtonPanel,BorderLayout.WEST);
  buttonPanel.add(eastButtonPanel,BorderLayout.EAST);
  chatRoomsTableUI=new ChatRoomTableUI(this);
  chatRoomsTableUI.setOpaque(false);
  chatRoomsTableUI.setBorder(BorderFactory.createEmptyBorder(5,15,5,15));
  northPanel.setPreferredSize(new Dimension(600,80));
  this.getContentPane().add(northPanel,BorderLayout.NORTH);
  this.getContentPane().add(buttonPanel,BorderLayout.SOUTH);
  this.getContentPane().add(chatRoomsTableUI,BorderLayout.CENTER);
  loadProviderRooms();
  editor.addKeyListener(new KeyListener(){
    public void keyTyped(    KeyEvent e){
      chatRoomsTableUI.clearSelection();
      if (editor.getText().trim().length() > 0) {
        okButton.setEnabled(true);
        addButton.setEnabled(true);
      }
 else {
        okButton.setEnabled(false);
        addButton.setEnabled(false);
      }
    }
    public void keyPressed(    KeyEvent e){
    }
    public void keyReleased(    KeyEvent e){
    }
  }
);
  chatRoomsTableUI.addSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      if (!e.getValueIsAdjusting()) {
        ChatRoomWrapper room=chatRoomsTableUI.getSelectedRoom();
        if (room != null) {
          editor.setText(room.getChatRoomName());
          providersCombo.setSelectedItem(room.getParentProvider());
          okButton.setEnabled(true);
          removeButton.setEnabled(true);
        }
 else         removeButton.setEnabled(false);
      }
    }
  }
);
  GuiActivator.getUIService().getConferenceChatManager().getChatRoomList().addChatRoomProviderWrapperListener(new ChatRoomList.ChatRoomProviderWrapperListener(){
    public void chatRoomProviderWrapperAdded(    ChatRoomProviderWrapper provider){
      providersCombo.addItem(provider);
    }
    public void chatRoomProviderWrapperRemoved(    ChatRoomProviderWrapper provider){
      providersCombo.removeItem(provider);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Initializes this chat room dialog.
 */
private void init(){
  this.getContentPane().setLayout(new BorderLayout(5,5));
  JPanel northPanel=new TransparentPanel(new BorderLayout(5,5));
  northPanel.setBorder(BorderFactory.createEmptyBorder(15,15,5,15));
  JPanel labels=new TransparentPanel(new GridLayout(2,2,5,5));
  labels.add(new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str")));
  labels.add(new JLabel(GuiActivator.getResources().getI18NString("String_Node_Str")));
  JPanel valuesPanel=new TransparentPanel(new GridLayout(2,2,5,5));
  providersCombo=createProvidersCombobox();
  roomsCombo=new JComboBox();
  roomsCombo.setEditable(true);
  roomsCombo.setPreferredSize(providersCombo.getPreferredSize());
  editor=((JTextField)roomsCombo.getEditor().getEditorComponent());
  providersCombo.addItemListener(new ItemListener(){
    public void itemStateChanged(    ItemEvent e){
      if (e.getStateChange() == ItemEvent.SELECTED)       loadProviderRooms();
    }
  }
);
  roomsCombo.addItemListener(new ItemListener(){
    public void itemStateChanged(    ItemEvent e){
      if (e.getStateChange() == ItemEvent.SELECTED && roomsCombo.getSelectedIndex() != -1) {
        okButton.setEnabled(true);
        addButton.setEnabled(true);
      }
    }
  }
);
  valuesPanel.add(providersCombo);
  valuesPanel.add(roomsCombo);
  northPanel.add(labels,BorderLayout.WEST);
  northPanel.add(valuesPanel,BorderLayout.CENTER);
  JPanel buttonPanel=new TransparentPanel(new BorderLayout(5,5));
  buttonPanel.setBorder(BorderFactory.createEmptyBorder(0,15,10,15));
  JPanel westButtonPanel=new TransparentPanel();
  JPanel eastButtonPanel=new TransparentPanel();
  addButton.addActionListener(this);
  removeButton.addActionListener(this);
  okButton.addActionListener(this);
  cancelButton.addActionListener(this);
  addButton.setEnabled(false);
  removeButton.setEnabled(false);
  westButtonPanel.add(addButton);
  westButtonPanel.add(removeButton);
  eastButtonPanel.add(cancelButton);
  eastButtonPanel.add(okButton);
  buttonPanel.add(westButtonPanel,BorderLayout.WEST);
  buttonPanel.add(eastButtonPanel,BorderLayout.EAST);
  chatRoomsTableUI=new ChatRoomTableUI(this);
  chatRoomsTableUI.setOpaque(false);
  chatRoomsTableUI.setBorder(BorderFactory.createEmptyBorder(5,15,5,15));
  northPanel.setPreferredSize(new Dimension(600,80));
  this.getContentPane().add(northPanel,BorderLayout.NORTH);
  this.getContentPane().add(buttonPanel,BorderLayout.SOUTH);
  this.getContentPane().add(chatRoomsTableUI,BorderLayout.CENTER);
  loadProviderRooms();
  editor.addKeyListener(new KeyListener(){
    public void keyTyped(    KeyEvent e){
    }
    public void keyPressed(    KeyEvent e){
    }
    public void keyReleased(    KeyEvent e){
      chatRoomsTableUI.clearSelection();
      if (editor.getText().trim().length() > 0) {
        okButton.setEnabled(true);
        addButton.setEnabled(true);
      }
 else {
        okButton.setEnabled(false);
        addButton.setEnabled(false);
      }
    }
  }
);
  chatRoomsTableUI.addSelectionListener(new ListSelectionListener(){
    public void valueChanged(    ListSelectionEvent e){
      if (!e.getValueIsAdjusting()) {
        ChatRoomWrapper room=chatRoomsTableUI.getSelectedRoom();
        if (room != null) {
          editor.setText(room.getChatRoomName());
          providersCombo.setSelectedItem(room.getParentProvider());
          okButton.setEnabled(true);
          removeButton.setEnabled(true);
        }
 else         removeButton.setEnabled(false);
      }
    }
  }
);
  GuiActivator.getUIService().getConferenceChatManager().getChatRoomList().addChatRoomProviderWrapperListener(new ChatRoomList.ChatRoomProviderWrapperListener(){
    public void chatRoomProviderWrapperAdded(    ChatRoomProviderWrapper provider){
      providersCombo.addItem(provider);
    }
    public void chatRoomProviderWrapperRemoved(    ChatRoomProviderWrapper provider){
      providersCombo.removeItem(provider);
    }
  }
);
}