Program: 158190
Project: 158190
Buggy source:
/** 
 * Creates new form TablesPanel
 */
public TablesPanel(){
  tableModel=new TableTableModel();
  matchesModel=new MatchesTableModel();
  gameChooser=new GameChooser();
  initComponents();
  tableTables.createDefaultColumnsFromModel();
  activeTablesSorter=new MageTableRowSorter(tableModel);
  tableTables.setRowSorter(activeTablesSorter);
  TableUtil.setColumnWidthAndOrder(tableTables,DEFAULT_COLUMNS_WIDTH,PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH,PreferencesDialog.KEY_TABLES_COLUMNS_ORDER);
  tableCompleted.setRowSorter(new MageTableRowSorter(matchesModel));
  chatPanelMain.getUserChatPanel().useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
  chatPanelMain.getUserChatPanel().setBorder(null);
  chatPanelMain.getUserChatPanel().setChatType(ChatPanelBasic.ChatType.TABLES);
  filterButtons=new JToggleButton[]{btnStateWaiting,btnStateActive,btnStateFinished,btnTypeMatch,btnTypeTourneyConstructed,btnTypeTourneyLimited,btnFormatBlock,btnFormatStandard,btnFormatModern,btnFormatLegacy,btnFormatVintage,btnFormatCommander,btnFormatTinyLeader,btnFormatLimited,btnFormatOther,btnSkillBeginner,btnSkillCasual,btnSkillSerious,btnRated,btnUnrated,btnOpen,btnPassword};
  JComponent[] components=new JComponent[]{chatPanelMain,jSplitPane1,jScrollPaneTablesActive,jScrollPaneTablesFinished,jPanelTop,jPanelTables};
  for (  JComponent component : components) {
    component.setOpaque(false);
  }
  jScrollPaneTablesActive.getViewport().setBackground(new Color(255,255,255,50));
  jScrollPaneTablesFinished.getViewport().setBackground(new Color(255,255,255,50));
  restoreSettings();
  setGUISize();
  Action openTableAction;
  openTableAction=new AbstractAction(){
    @Override public void actionPerformed(    ActionEvent e){
      int modelRow=Integer.valueOf(e.getActionCommand());
      UUID tableId=(UUID)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 3);
      UUID gameId=(UUID)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 2);
      String action=(String)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN);
      String deckType=(String)tableModel.getValueAt(modelRow,TableTableModel.COLUMN_DECK_TYPE);
      String status=(String)tableModel.getValueAt(modelRow,TableTableModel.COLUMN_STATUS);
      boolean isTournament=(Boolean)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 1);
      String owner=(String)tableModel.getValueAt(modelRow,TableTableModel.COLUMN_OWNER);
switch (action) {
case "String_Node_Str":
        if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + "String_Node_Str")) {
          try {
            JDesktopPane desktopPane=(JDesktopPane)MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
            JInternalFrame[] windows=desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
            for (            JInternalFrame frame : windows) {
              if (frame.getTitle().equals("String_Node_Str")) {
                frame.toFront();
                frame.setVisible(true);
                try {
                  frame.setSelected(true);
                }
 catch (                PropertyVetoException ve) {
                  LOGGER.error(ve);
                }
              }
            }
          }
 catch (          InterruptedException ex) {
            LOGGER.error(ex);
          }
          return;
        }
      if (isTournament) {
        LOGGER.info("String_Node_Str" + tableId);
        if (deckType.startsWith("String_Node_Str")) {
          if (!status.endsWith("String_Node_Str")) {
            SessionHandler.joinTournamentTable(roomId,tableId,SessionHandler.getUserName(),"String_Node_Str",1,null,"String_Node_Str");
          }
 else {
            joinTableDialog.showDialog(roomId,tableId,true,deckType.startsWith("String_Node_Str"));
          }
        }
 else {
          joinTableDialog.showDialog(roomId,tableId,true,deckType.startsWith("String_Node_Str"));
        }
      }
 else {
        LOGGER.info("String_Node_Str" + tableId);
        joinTableDialog.showDialog(roomId,tableId,false,false);
      }
    break;
case "String_Node_Str":
  UserRequestMessage message=new UserRequestMessage("String_Node_Str","String_Node_Str");
message.setButton1("String_Node_Str",null);
message.setButton2("String_Node_Str",PlayerAction.CLIENT_REMOVE_TABLE);
MageFrame.getInstance().showUserRequestDialog(message);
break;
case "String_Node_Str":
if (isTournament) {
LOGGER.info("String_Node_Str" + tableId);
SessionHandler.watchTable(roomId,tableId);
}
break;
case "String_Node_Str":
if (!isTournament) {
LOGGER.info("String_Node_Str" + tableId);
SessionHandler.watchTable(roomId,tableId);
}
break;
case "String_Node_Str":
LOGGER.info("String_Node_Str" + gameId);
SessionHandler.replayGame(gameId);
break;
}
}
}
;
Action closedTableAction;
closedTableAction=new AbstractAction(){
@Override public void actionPerformed(ActionEvent e){
int modelRow=Integer.valueOf(e.getActionCommand());
String action=(String)matchesModel.getValueAt(modelRow,MatchesTableModel.ACTION_COLUMN);
switch (action) {
case "String_Node_Str":
List<UUID> gameList=matchesModel.getListofGames(modelRow);
if (gameList != null && gameList.size() > 0) {
if (gameList.size() == 1) {
SessionHandler.replayGame(gameList.get(0));
}
 else {
gameChooser.show(gameList,MageFrame.getDesktop().getMousePosition());
}
}
break;
case "String_Node_Str":
if (matchesModel.isTournament(modelRow)) {
LOGGER.info("String_Node_Str" + matchesModel.getTableId(modelRow));
SessionHandler.watchTable(roomId,matchesModel.getTableId(modelRow));
}
break;
}
}
}
;
actionButton1=new ButtonColumn(tableTables,openTableAction,tableTables.convertColumnIndexToView(TableTableModel.ACTION_COLUMN));
actionButton2=new ButtonColumn(tableCompleted,closedTableAction,tableCompleted.convertColumnIndexToView(MatchesTableModel.ACTION_COLUMN));
}

Fixed version (ground truth):
/** 
 * Creates new form TablesPanel
 */
public TablesPanel(){
  tableModel=new TableTableModel();
  matchesModel=new MatchesTableModel();
  gameChooser=new GameChooser();
  initComponents();
  tableTables.createDefaultColumnsFromModel();
  activeTablesSorter=new MageTableRowSorter(tableModel);
  tableTables.setRowSorter(activeTablesSorter);
  TableUtil.setColumnWidthAndOrder(tableTables,DEFAULT_COLUMNS_WIDTH,PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH,PreferencesDialog.KEY_TABLES_COLUMNS_ORDER);
  tableCompleted.setRowSorter(new MageTableRowSorter(matchesModel));
  chatPanelMain.getUserChatPanel().useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
  chatPanelMain.getUserChatPanel().setBorder(null);
  chatPanelMain.getUserChatPanel().setChatType(ChatPanelBasic.ChatType.TABLES);
  filterButtons=new JToggleButton[]{btnStateWaiting,btnStateActive,btnStateFinished,btnTypeMatch,btnTypeTourneyConstructed,btnTypeTourneyLimited,btnFormatBlock,btnFormatStandard,btnFormatModern,btnFormatLegacy,btnFormatVintage,btnFormatCommander,btnFormatTinyLeader,btnFormatLimited,btnFormatOther,btnSkillBeginner,btnSkillCasual,btnSkillSerious,btnRated,btnUnrated,btnOpen,btnPassword};
  JComponent[] components=new JComponent[]{chatPanelMain,jSplitPane1,jScrollPaneTablesActive,jScrollPaneTablesFinished,jPanelTop,jPanelTables};
  for (  JComponent component : components) {
    component.setOpaque(false);
  }
  jScrollPaneTablesActive.getViewport().setBackground(new Color(255,255,255,50));
  jScrollPaneTablesFinished.getViewport().setBackground(new Color(255,255,255,50));
  restoreSettings();
  setGUISize();
  Action openTableAction;
  openTableAction=new AbstractAction(){
    @Override public void actionPerformed(    ActionEvent e){
      int modelRow=Integer.valueOf(e.getActionCommand());
      UUID tableId=(UUID)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 3);
      UUID gameId=(UUID)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 2);
      String action=(String)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN);
      String deckType=(String)tableModel.getValueAt(modelRow,TableTableModel.COLUMN_DECK_TYPE);
      boolean isTournament=(Boolean)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 1);
      String owner=(String)tableModel.getValueAt(modelRow,TableTableModel.COLUMN_OWNER);
      String pwdColumn=(String)tableModel.getValueAt(modelRow,TableTableModel.COLUMN_PASSWORD);
switch (action) {
case "String_Node_Str":
        if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + "String_Node_Str")) {
          try {
            JDesktopPane desktopPane=(JDesktopPane)MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
            JInternalFrame[] windows=desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
            for (            JInternalFrame frame : windows) {
              if (frame.getTitle().equals("String_Node_Str")) {
                frame.toFront();
                frame.setVisible(true);
                try {
                  frame.setSelected(true);
                }
 catch (                PropertyVetoException ve) {
                  LOGGER.error(ve);
                }
              }
            }
          }
 catch (          InterruptedException ex) {
            LOGGER.error(ex);
          }
          return;
        }
      if (isTournament) {
        LOGGER.info("String_Node_Str" + tableId);
        if (deckType.startsWith("String_Node_Str")) {
          if (PASSWORDED.equals(pwdColumn)) {
            joinTableDialog.showDialog(roomId,tableId,true,deckType.startsWith("String_Node_Str"));
          }
 else {
            SessionHandler.joinTournamentTable(roomId,tableId,SessionHandler.getUserName(),"String_Node_Str",1,null,"String_Node_Str");
          }
        }
 else {
          joinTableDialog.showDialog(roomId,tableId,true,deckType.startsWith("String_Node_Str"));
        }
      }
 else {
        LOGGER.info("String_Node_Str" + tableId);
        joinTableDialog.showDialog(roomId,tableId,false,false);
      }
    break;
case "String_Node_Str":
  UserRequestMessage message=new UserRequestMessage("String_Node_Str","String_Node_Str");
message.setButton1("String_Node_Str",null);
message.setButton2("String_Node_Str",PlayerAction.CLIENT_REMOVE_TABLE);
MageFrame.getInstance().showUserRequestDialog(message);
break;
case "String_Node_Str":
if (isTournament) {
LOGGER.info("String_Node_Str" + tableId);
SessionHandler.watchTable(roomId,tableId);
}
break;
case "String_Node_Str":
if (!isTournament) {
LOGGER.info("String_Node_Str" + tableId);
SessionHandler.watchTable(roomId,tableId);
}
break;
case "String_Node_Str":
LOGGER.info("String_Node_Str" + gameId);
SessionHandler.replayGame(gameId);
break;
}
}
}
;
Action closedTableAction;
closedTableAction=new AbstractAction(){
@Override public void actionPerformed(ActionEvent e){
int modelRow=Integer.valueOf(e.getActionCommand());
String action=(String)matchesModel.getValueAt(modelRow,MatchesTableModel.ACTION_COLUMN);
switch (action) {
case "String_Node_Str":
List<UUID> gameList=matchesModel.getListofGames(modelRow);
if (gameList != null && gameList.size() > 0) {
if (gameList.size() == 1) {
SessionHandler.replayGame(gameList.get(0));
}
 else {
gameChooser.show(gameList,MageFrame.getDesktop().getMousePosition());
}
}
break;
case "String_Node_Str":
if (matchesModel.isTournament(modelRow)) {
LOGGER.info("String_Node_Str" + matchesModel.getTableId(modelRow));
SessionHandler.watchTable(roomId,matchesModel.getTableId(modelRow));
}
break;
}
}
}
;
actionButton1=new ButtonColumn(tableTables,openTableAction,tableTables.convertColumnIndexToView(TableTableModel.ACTION_COLUMN));
actionButton2=new ButtonColumn(tableCompleted,closedTableAction,tableCompleted.convertColumnIndexToView(MatchesTableModel.ACTION_COLUMN));
}