Program: 157675
Project: 157675
Buggy source:
/** 
 * Creates new form TablesPanel
 */
public TablesPanel(){
  tableModel=new TableTableModel();
  matchesModel=new MatchesTableModel();
  gameChooser=new GameChooser();
  initComponents();
  timeFormater.setLocale(Locale.ENGLISH);
  JustNow jn=timeFormater.getUnit(JustNow.class);
  jn.setMaxQuantity(1000L * 30L);
  tableTables.createDefaultColumnsFromModel();
  activeTablesSorter=new MageTableRowSorter(tableModel);
  tableTables.setRowSorter(activeTablesSorter);
  tableTables.getColumnModel().getColumn(TableTableModel.COLUMN_CREATED).setCellRenderer(timeAgoCellRenderer);
  ArrayList list=new ArrayList();
  list.add(new RowSorter.SortKey(TableTableModel.COLUMN_CREATED,SortOrder.DESCENDING));
  activeTablesSorter.setSortKeys(list);
  TableUtil.setColumnWidthAndOrder(tableTables,DEFAULT_COLUMNS_WIDTH,PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH,PreferencesDialog.KEY_TABLES_COLUMNS_ORDER);
  completedTablesSorter=new MageTableRowSorter(matchesModel);
  tableCompleted.setRowSorter(completedTablesSorter);
  tableCompleted.getColumnModel().getColumn(MatchesTableModel.COLUMN_DURATION).setCellRenderer(durationCellRenderer);
  tableCompleted.getColumnModel().getColumn(MatchesTableModel.COLUMN_START).setCellRenderer(datetimeCellRenderer);
  tableCompleted.getColumnModel().getColumn(MatchesTableModel.COLUMN_END).setCellRenderer(datetimeCellRenderer);
  ArrayList list2=new ArrayList();
  list2.add(new RowSorter.SortKey(MatchesTableModel.COLUMN_END,SortOrder.DESCENDING));
  completedTablesSorter.setSortKeys(list2);
  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() + ',')) {
          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 (TableTableModel.PASSWORD_VALUE_YES.equals(pwdColumn)) {
            joinTableDialog.showDialog(roomId,tableId,true,deckType.startsWith("String_Node_Str"));
          }
 else {
            SessionHandler.joinTournamentTable(roomId,tableId,SessionHandler.getUserName(),PlayerType.HUMAN,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.COLUMN_ACTION);
switch (action) {
case "String_Node_Str":
java.util.List<UUID> gameList=matchesModel.getListofGames(modelRow);
if (gameList != null && !gameList.isEmpty()) {
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.COLUMN_ACTION));
}

Fixed version (ground truth):
/** 
 * Creates new form TablesPanel
 */
public TablesPanel(){
  tableModel=new TableTableModel();
  matchesModel=new MatchesTableModel();
  gameChooser=new GameChooser();
  initComponents();
  timeFormater.setLocale(Locale.ENGLISH);
  JustNow jn=timeFormater.getUnit(JustNow.class);
  jn.setMaxQuantity(1000L * 30L);
  tableTables.createDefaultColumnsFromModel();
  activeTablesSorter=new MageTableRowSorter(tableModel);
  tableTables.setRowSorter(activeTablesSorter);
  tableTables.getColumnModel().getColumn(TableTableModel.COLUMN_CREATED).setCellRenderer(timeAgoCellRenderer);
  ArrayList list=new ArrayList();
  list.add(new RowSorter.SortKey(TableTableModel.COLUMN_CREATED,SortOrder.DESCENDING));
  activeTablesSorter.setSortKeys(list);
  TableUtil.setColumnWidthAndOrder(tableTables,DEFAULT_COLUMNS_WIDTH,KEY_TABLES_COLUMNS_WIDTH,KEY_TABLES_COLUMNS_ORDER);
  completedTablesSorter=new MageTableRowSorter(matchesModel);
  tableCompleted.setRowSorter(completedTablesSorter);
  tableCompleted.getColumnModel().getColumn(MatchesTableModel.COLUMN_DURATION).setCellRenderer(durationCellRenderer);
  tableCompleted.getColumnModel().getColumn(MatchesTableModel.COLUMN_START).setCellRenderer(datetimeCellRenderer);
  tableCompleted.getColumnModel().getColumn(MatchesTableModel.COLUMN_END).setCellRenderer(datetimeCellRenderer);
  ArrayList list2=new ArrayList();
  list2.add(new RowSorter.SortKey(MatchesTableModel.COLUMN_END,SortOrder.DESCENDING));
  completedTablesSorter.setSortKeys(list2);
  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));
  restoreFilters();
  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() + ',')) {
          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 (TableTableModel.PASSWORD_VALUE_YES.equals(pwdColumn)) {
            joinTableDialog.showDialog(roomId,tableId,true,deckType.startsWith("String_Node_Str"));
          }
 else {
            SessionHandler.joinTournamentTable(roomId,tableId,SessionHandler.getUserName(),PlayerType.HUMAN,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.COLUMN_ACTION);
switch (action) {
case "String_Node_Str":
java.util.List<UUID> gameList=matchesModel.getListofGames(modelRow);
if (gameList != null && !gameList.isEmpty()) {
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.COLUMN_ACTION));
}