Program: 159519
Project: 159519
Buggy source:
/** 
 * Creates new form TablesPanel 
 */
public TablesPanel(){
  tableModel=new TableTableModel();
  matchesModel=new MatchesTableModel();
  gameChooser=new GameChooser();
  initComponents();
  tableModel.setSession(session);
  chkShowCompleted.setVisible(true);
  tableTables.createDefaultColumnsFromModel();
  chatPanel.useExtendedView(ChatPanel.VIEW_MODE.NONE);
  chatPanel.setBorder(null);
  chatPanel.setChatType(ChatPanel.ChatType.TABLES);
  JComponent[] components=new JComponent[]{chatPanel,jSplitPane1,jScrollPane1,jScrollPane2,jPanel1,jPanel3};
  for (  JComponent component : components) {
    component.setOpaque(false);
  }
  jScrollPane1.getViewport().setBackground(new Color(255,255,255,50));
  jScrollPane2.getViewport().setBackground(new Color(255,255,255,50));
  Action joinTable;
  joinTable=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);
      boolean isTournament=(Boolean)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 1);
      String owner=(String)tableModel.getValueAt(modelRow,1);
      if (action.equals("String_Node_Str")) {
        if (owner.equals(session.getUserName())) {
          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) {
                  ve.printStackTrace();
                  logger.error(ve);
                }
              }
            }
          }
 catch (          Exception ex) {
            logger.error(ex);
          }
          return;
        }
        if (isTournament) {
          logger.info("String_Node_Str" + tableId);
          session.joinTournamentTable(roomId,tableId,session.getUserName(),"String_Node_Str",1);
        }
 else {
          logger.info("String_Node_Str" + tableId);
          joinTableDialog.showDialog(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        if (JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
          session.removeTable(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        if (isTournament) {
          logger.info("String_Node_Str" + tableId);
          session.watchTable(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        if (!isTournament) {
          logger.info("String_Node_Str" + tableId);
          session.watchTable(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        logger.info("String_Node_Str" + gameId);
      }
    }
  }
;
  Action replayMatch=new AbstractAction(){
    @Override public void actionPerformed(    ActionEvent e){
      int modelRow=Integer.valueOf(e.getActionCommand());
      if (matchesModel.getValueAt(modelRow,MatchesTableModel.ACTION_COLUMN) instanceof List) {
        List<UUID> games=(List<UUID>)matchesModel.getValueAt(modelRow,MatchesTableModel.ACTION_COLUMN);
        if (games.size() == 1) {
          session.replayGame(games.get(0));
        }
 else {
          gameChooser.show(games,MageFrame.getDesktop().getMousePosition());
        }
      }
    }
  }
;
  new ButtonColumn(tableTables,joinTable,TableTableModel.ACTION_COLUMN);
  new ButtonColumn(tableCompleted,replayMatch,MatchesTableModel.ACTION_COLUMN);
}

Fixed version (ground truth):
/** 
 * Creates new form TablesPanel 
 */
public TablesPanel(){
  tableModel=new TableTableModel();
  matchesModel=new MatchesTableModel();
  gameChooser=new GameChooser();
  initComponents();
  tableModel.setSession(session);
  chkShowCompleted.setVisible(true);
  tableTables.createDefaultColumnsFromModel();
  chatPanel.useExtendedView(ChatPanel.VIEW_MODE.NONE);
  chatPanel.setBorder(null);
  chatPanel.setChatType(ChatPanel.ChatType.TABLES);
  JComponent[] components=new JComponent[]{chatPanel,jSplitPane1,jScrollPane1,jScrollPane2,jPanel1,jPanel3};
  for (  JComponent component : components) {
    component.setOpaque(false);
  }
  jScrollPane1.getViewport().setBackground(new Color(255,255,255,50));
  jScrollPane2.getViewport().setBackground(new Color(255,255,255,50));
  Action joinTable;
  joinTable=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);
      boolean isTournament=(Boolean)tableModel.getValueAt(modelRow,TableTableModel.ACTION_COLUMN + 1);
      String owner=(String)tableModel.getValueAt(modelRow,1);
      if (action.equals("String_Node_Str")) {
        if (owner.equals(session.getUserName())) {
          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) {
                  ve.printStackTrace();
                  logger.error(ve);
                }
              }
            }
          }
 catch (          Exception ex) {
            logger.error(ex);
          }
          return;
        }
        if (isTournament) {
          logger.info("String_Node_Str" + tableId);
          session.joinTournamentTable(roomId,tableId,session.getUserName(),"String_Node_Str",1);
        }
 else {
          logger.info("String_Node_Str" + tableId);
          joinTableDialog.showDialog(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        if (JOptionPane.showConfirmDialog(null,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
          session.removeTable(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        if (isTournament) {
          logger.info("String_Node_Str" + tableId);
          session.watchTable(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        if (!isTournament) {
          logger.info("String_Node_Str" + tableId);
          session.watchTable(roomId,tableId);
        }
      }
 else       if (action.equals("String_Node_Str")) {
        logger.info("String_Node_Str" + gameId);
        session.replayGame(gameId);
      }
    }
  }
;
  Action replayMatch=new AbstractAction(){
    @Override public void actionPerformed(    ActionEvent e){
      int modelRow=Integer.valueOf(e.getActionCommand());
      if (matchesModel.getValueAt(modelRow,MatchesTableModel.GAMES_LIST_COLUMN) instanceof List) {
        List<UUID> games=(List<UUID>)matchesModel.getValueAt(modelRow,MatchesTableModel.GAMES_LIST_COLUMN);
        if (games.size() == 1) {
          session.replayGame(games.get(0));
        }
 else {
          gameChooser.show(games,MageFrame.getDesktop().getMousePosition());
        }
      }
    }
  }
;
  new ButtonColumn(tableTables,joinTable,TableTableModel.ACTION_COLUMN);
  new ButtonColumn(tableCompleted,replayMatch,MatchesTableModel.ACTION_COLUMN);
}