Program: 49914
Project: 49914
Buggy source:
/** 
 * This is the method to open the pop up to create a new game.
 * @param isNetwork boolean to see if this is a network game or not
 */
public void setupPopup(final boolean isNetwork){
  clicked=true;
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setLayout(new GridBagLayout());
  popup.setSize(325,225);
  popup.setResizable(false);
  popup.setLocationRelativeTo(null);
  GridBagConstraints c=new GridBagConstraints();
  String[] gametypes=Builder.getArray();
  if (isNetwork) {
    ArrayList<String> filtered=new ArrayList<String>();
    for (    String s : gametypes) {
      Game temp=Builder.newGame(s);
      if (temp.getWhiteRules().networkable() && temp.getBlackRules().networkable())       filtered.add(s);
    }
    gametypes=new String[filtered.size()];
    int i=0;
    for (    String s : filtered)     gametypes[i++]=s;
  }
  final JComboBox dropdown=new JComboBox(gametypes);
  c.gridx=0;
  c.gridy=0;
  c.anchor=GridBagConstraints.WEST;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=1;
  c.gridy=0;
  c.fill=GridBagConstraints.HORIZONTAL;
  popup.add(dropdown,c);
  final JButton done=new JButton("String_Node_Str");
  String[] timerNames={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  final JComboBox timers=new JComboBox(timerNames);
  final JLabel totalTimeText=new JLabel("String_Node_Str");
  totalTimeText.setVisible(false);
  final TextField totalTime=new TextField("String_Node_Str",3);
  totalTime.setVisible(false);
  final JLabel increaseText=new JLabel("String_Node_Str");
  increaseText.setVisible(false);
  final TextField increase=new TextField("String_Node_Str",3);
  increase.setVisible(false);
  timers.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      String timerName=(String)timers.getSelectedItem();
      if (timerName.equals("String_Node_Str") == false) {
        totalTimeText.setVisible(true);
        totalTime.setVisible(true);
        increaseText.setVisible(true);
        increase.setVisible(true);
      }
 else {
        totalTimeText.setVisible(false);
        totalTime.setVisible(false);
        increaseText.setVisible(false);
        increase.setVisible(false);
      }
    }
  }
);
  c.gridx=0;
  c.gridy=1;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=1;
  c.gridy=1;
  c.fill=GridBagConstraints.HORIZONTAL;
  popup.add(timers,c);
  c.gridx=0;
  c.gridy=2;
  popup.add(totalTimeText,c);
  c.gridx=1;
  c.gridy=2;
  popup.add(totalTime,c);
  c.gridx=0;
  c.gridy=3;
  c.anchor=GridBagConstraints.CENTER;
  popup.add(increaseText,c);
  c.gridx=1;
  c.gridy=3;
  popup.add(increase,c);
  popup.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  popup.addWindowListener(new WindowListener(){
    @Override public void windowActivated(    WindowEvent arg0){
    }
    @Override public void windowClosed(    WindowEvent arg0){
    }
    @Override public void windowClosing(    WindowEvent arg0){
      clicked=false;
      popup.setVisible(false);
      popup.dispose();
    }
    @Override public void windowDeactivated(    WindowEvent arg0){
    }
    @Override public void windowDeiconified(    WindowEvent arg0){
    }
    @Override public void windowIconified(    WindowEvent arg0){
    }
    @Override public void windowOpened(    WindowEvent arg0){
    }
  }
);
  done.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      clicked=false;
      String timerName=(String)timers.getSelectedItem();
      long startTime=Integer.parseInt(totalTime.getText()) * 1000;
      long increment=Integer.parseInt(increase.getText()) * 1000;
      ChessTimer blackTimer=null;
      ChessTimer whiteTimer=null;
      if (timerName.equals("String_Node_Str")) {
        blackTimer=new NoTimer();
        whiteTimer=new NoTimer();
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new BronsteinDelay(increment,startTime,true);
        whiteTimer=new BronsteinDelay(increment,startTime,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new Fischer(increment,startTime,false,true);
        whiteTimer=new Fischer(increment,startTime,false,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new Fischer(increment,startTime,true,true);
        whiteTimer=new Fischer(increment,startTime,true,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new HourGlass(startTime / 2,true);
        whiteTimer=new HourGlass(startTime / 2,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new SimpleDelay(increment,startTime,true);
        whiteTimer=new SimpleDelay(increment,startTime,false);
      }
 else {
        blackTimer=new Word(startTime);
        whiteTimer=new Word(startTime);
      }
      if (isNetwork) {
        Game toPlay=Builder.newGame((String)dropdown.getSelectedItem());
        toPlay.setTimers(whiteTimer,blackTimer);
        final PlayNetGame game;
        if (host.equals(arg0)) {
          try {
            game=new PlayNetGame(toPlay,false,true);
          }
 catch (          Exception e) {
            return;
          }
        }
 else {
          try {
            game=new PlayNetGame(toPlay,false,false);
          }
 catch (          Exception e) {
            return;
          }
        }
        try {
          NewGameMenu.cancelled=false;
          Thread host=new Thread(new Runnable(){
            @Override public void run(){
              try {
                new NetworkServer().host(game);
              }
 catch (              Exception e) {
                e.printStackTrace();
              }
            }
          }
);
          Driver.getInstance().setPanel(new NetLoading(host));
          host.start();
        }
 catch (        Exception e) {
          System.out.println("String_Node_Str");
          e.printStackTrace();
        }
      }
 else {
        Game toPlay=Builder.newGame((String)dropdown.getSelectedItem());
        toPlay.setTimers(whiteTimer,blackTimer);
        PlayGame game=null;
        try {
          game=new PlayGame(toPlay,false);
        }
 catch (        Exception e) {
          e.printStackTrace();
          return;
        }
        Driver.getInstance().setPanel(game);
      }
      popup.dispose();
    }
  }
);
  final JButton back=new JButton("String_Node_Str");
  back.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      clicked=false;
      popup.dispose();
    }
  }
);
  JPanel buttons=new JPanel();
  buttons.setLayout(new FlowLayout());
  buttons.add(done);
  buttons.add(back);
  c.gridx=0;
  c.gridy=4;
  c.gridwidth=2;
  c.fill=GridBagConstraints.HORIZONTAL;
  popup.add(buttons,c);
  popup.setVisible(true);
}

Fixed version (ground truth):
/** 
 * This is the method to open the pop up to create a new game.
 * @param isNetwork boolean to see if this is a network game or not
 */
public void setupPopup(final boolean isNetwork){
  clicked=true;
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setLayout(new GridBagLayout());
  popup.setSize(325,225);
  popup.setResizable(false);
  popup.setLocationRelativeTo(null);
  GridBagConstraints c=new GridBagConstraints();
  String[] gametypes=Builder.getArray();
  if (isNetwork) {
    ArrayList<String> filtered=new ArrayList<String>();
    for (    String s : gametypes) {
      Game temp=Builder.newGame(s);
      if (temp.getWhiteRules().networkable() && temp.getBlackRules().networkable())       filtered.add(s);
    }
    gametypes=new String[filtered.size()];
    int i=0;
    for (    String s : filtered)     gametypes[i++]=s;
  }
  final JComboBox dropdown=new JComboBox(gametypes);
  c.gridx=0;
  c.gridy=0;
  c.anchor=GridBagConstraints.WEST;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=1;
  c.gridy=0;
  c.fill=GridBagConstraints.HORIZONTAL;
  popup.add(dropdown,c);
  final JButton done=new JButton("String_Node_Str");
  String[] timerNames={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  final JComboBox timers=new JComboBox(timerNames);
  final JLabel totalTimeText=new JLabel("String_Node_Str");
  totalTimeText.setVisible(false);
  final JTextField totalTime=new JTextField("String_Node_Str",3);
  totalTime.setVisible(false);
  final JLabel increaseText=new JLabel("String_Node_Str");
  increaseText.setVisible(false);
  final JTextField increase=new JTextField("String_Node_Str",3);
  increase.setVisible(false);
  timers.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      String timerName=(String)timers.getSelectedItem();
      if (timerName.equals("String_Node_Str") == false) {
        totalTimeText.setVisible(true);
        totalTime.setVisible(true);
        increaseText.setVisible(true);
        increase.setVisible(true);
      }
 else {
        totalTimeText.setVisible(false);
        totalTime.setVisible(false);
        increaseText.setVisible(false);
        increase.setVisible(false);
      }
    }
  }
);
  c.gridx=0;
  c.gridy=1;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=1;
  c.gridy=1;
  c.fill=GridBagConstraints.HORIZONTAL;
  popup.add(timers,c);
  c.gridx=0;
  c.gridy=2;
  popup.add(totalTimeText,c);
  c.gridx=1;
  c.gridy=2;
  popup.add(totalTime,c);
  c.gridx=0;
  c.gridy=3;
  c.anchor=GridBagConstraints.CENTER;
  popup.add(increaseText,c);
  c.gridx=1;
  c.gridy=3;
  popup.add(increase,c);
  popup.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  popup.addWindowListener(new WindowListener(){
    @Override public void windowActivated(    WindowEvent arg0){
    }
    @Override public void windowClosed(    WindowEvent arg0){
    }
    @Override public void windowClosing(    WindowEvent arg0){
      clicked=false;
      popup.setVisible(false);
      popup.dispose();
    }
    @Override public void windowDeactivated(    WindowEvent arg0){
    }
    @Override public void windowDeiconified(    WindowEvent arg0){
    }
    @Override public void windowIconified(    WindowEvent arg0){
    }
    @Override public void windowOpened(    WindowEvent arg0){
    }
  }
);
  done.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      clicked=false;
      String timerName=(String)timers.getSelectedItem();
      long startTime=Integer.parseInt(totalTime.getText()) * 1000;
      long increment=Integer.parseInt(increase.getText()) * 1000;
      ChessTimer blackTimer=null;
      ChessTimer whiteTimer=null;
      if (timerName.equals("String_Node_Str")) {
        blackTimer=new NoTimer();
        whiteTimer=new NoTimer();
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new BronsteinDelay(increment,startTime,true);
        whiteTimer=new BronsteinDelay(increment,startTime,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new Fischer(increment,startTime,false,true);
        whiteTimer=new Fischer(increment,startTime,false,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new Fischer(increment,startTime,true,true);
        whiteTimer=new Fischer(increment,startTime,true,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new HourGlass(startTime / 2,true);
        whiteTimer=new HourGlass(startTime / 2,false);
      }
 else       if (timerName.equals("String_Node_Str")) {
        blackTimer=new SimpleDelay(increment,startTime,true);
        whiteTimer=new SimpleDelay(increment,startTime,false);
      }
 else {
        blackTimer=new Word(startTime);
        whiteTimer=new Word(startTime);
      }
      if (isNetwork) {
        Game toPlay=Builder.newGame((String)dropdown.getSelectedItem());
        toPlay.setTimers(whiteTimer,blackTimer);
        final PlayNetGame game;
        if (host.equals(arg0)) {
          try {
            game=new PlayNetGame(toPlay,false,true);
          }
 catch (          Exception e) {
            return;
          }
        }
 else {
          try {
            game=new PlayNetGame(toPlay,false,false);
          }
 catch (          Exception e) {
            return;
          }
        }
        try {
          NewGameMenu.cancelled=false;
          Thread host=new Thread(new Runnable(){
            @Override public void run(){
              try {
                new NetworkServer().host(game);
              }
 catch (              Exception e) {
                e.printStackTrace();
              }
            }
          }
);
          Driver.getInstance().setPanel(new NetLoading(host));
          host.start();
        }
 catch (        Exception e) {
          System.out.println("String_Node_Str");
          e.printStackTrace();
        }
      }
 else {
        Game toPlay=Builder.newGame((String)dropdown.getSelectedItem());
        toPlay.setTimers(whiteTimer,blackTimer);
        PlayGame game=null;
        try {
          game=new PlayGame(toPlay,false);
        }
 catch (        Exception e) {
          e.printStackTrace();
          return;
        }
        Driver.getInstance().setPanel(game);
      }
      popup.dispose();
    }
  }
);
  final JButton back=new JButton("String_Node_Str");
  back.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      clicked=false;
      popup.dispose();
    }
  }
);
  JPanel buttons=new JPanel();
  buttons.setLayout(new FlowLayout());
  buttons.add(done);
  buttons.add(back);
  c.gridx=0;
  c.gridy=4;
  c.gridwidth=2;
  c.fill=GridBagConstraints.HORIZONTAL;
  popup.add(buttons,c);
  popup.setVisible(true);
}