Program: 49917
Project: 49917
Buggy source:
/** 
 * Creates a pop up box for the Promotion Options.
 * @param type The type of piece that can be promoted.
 */
private void promotion(final String type){
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setSize(500,300);
  popup.setLocationRelativeTo(null);
  popup.setLayout(new GridBagLayout());
  popup.setResizable(false);
  final DefaultListModel emptyList=new DefaultListModel();
  final DefaultListModel list=new DefaultListModel();
  Object[] allPieces=PieceBuilder.getSet().toArray();
  for (int i=0; i < allPieces.length; i++) {
    if (!allPieces[i].equals(type))     list.addElement(allPieces[i]);
  }
  final JList piecesList=new JList(list);
  final JList piecesList2=new JList(emptyList);
  final JButton moveLeft=new JButton();
  moveLeft.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      try {
        int index=piecesList2.getSelectedIndex();
        list.addElement(emptyList.elementAt(index));
        emptyList.remove(index);
      }
 catch (      Exception e) {
      }
    }
  }
);
  moveLeft.setText("String_Node_Str");
  final JButton moveRight=new JButton();
  moveRight.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      int index=piecesList.getSelectedIndex();
      try {
        emptyList.addElement(list.elementAt(index));
        list.remove(index);
      }
 catch (      Exception e) {
      }
    }
  }
);
  moveRight.setText("String_Node_Str");
  piecesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  piecesList.setLayoutOrientation(JList.VERTICAL);
  piecesList.setVisibleRowCount(-1);
  piecesList.setSelectedIndex(0);
  piecesList2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  piecesList2.setLayoutOrientation(JList.VERTICAL);
  piecesList2.setVisibleRowCount(-1);
  piecesList2.setSelectedIndex(0);
  JScrollPane scrollPane=new JScrollPane(piecesList);
  scrollPane.setPreferredSize(new Dimension(200,200));
  ListSelectionModel selectList=piecesList.getSelectionModel();
  selectList.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      if (e.getValueIsAdjusting() == false) {
        if (piecesList.getSelectedIndex() == -1) {
          moveLeft.setEnabled(false);
          moveRight.setEnabled(false);
        }
 else {
          moveLeft.setEnabled(true);
          moveRight.setEnabled(true);
        }
      }
    }
  }
);
  JScrollPane scrollPane2=new JScrollPane(piecesList2);
  scrollPane2.setPreferredSize(new Dimension(200,200));
  ListSelectionModel selectList2=piecesList2.getSelectionModel();
  selectList2.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      if (e.getValueIsAdjusting() == false) {
        if (piecesList2.getSelectedIndex() == -1) {
          moveLeft.setEnabled(false);
          moveRight.setEnabled(false);
        }
 else {
          moveLeft.setEnabled(true);
          moveRight.setEnabled(true);
        }
      }
    }
  }
);
  JButton submitButton=new JButton("String_Node_Str");
  submitButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      ArrayList<String> promotesTo=new ArrayList<String>();
      for (int i=0; i < emptyList.size(); i++) {
        promotesTo.add((String)emptyList.get(i));
      }
      promotions.put(type,promotesTo);
      popup.dispose();
    }
  }
);
  JButton backButton=new JButton("String_Node_Str");
  backButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      popup.dispose();
    }
  }
);
  JPanel options=new JPanel();
  options.add(backButton);
  options.add(submitButton);
  JPanel otherCrap=new JPanel();
  otherCrap.setLayout(new GridBagLayout());
  GridBagConstraints c=new GridBagConstraints();
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=1;
  otherCrap.add(moveRight,c);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=2;
  otherCrap.add(moveLeft,c);
  c.gridx=0;
  c.gridy=0;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=0;
  c.gridy=1;
  popup.add(scrollPane,c);
  c.gridx=1;
  c.gridy=1;
  popup.add(otherCrap,c);
  c.gridx=2;
  c.gridy=0;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=2;
  c.gridy=1;
  popup.add(scrollPane2,c);
  c.gridx=0;
  c.gridy=2;
  c.gridwidth=3;
  popup.add(options,c);
  popup.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Creates a pop up box for the Promotion Options.
 * @param type The type of piece that can be promoted.
 */
private void promotion(final String type){
  final JFrame popup=new JFrame("String_Node_Str");
  popup.setSize(500,300);
  popup.setLocationRelativeTo(null);
  popup.setLayout(new GridBagLayout());
  popup.setResizable(false);
  final DefaultListModel emptyList=new DefaultListModel();
  final DefaultListModel list=new DefaultListModel();
  Object[] allPieces=PieceBuilder.getSet().toArray();
  for (int i=0; i < allPieces.length; i++) {
    if (!allPieces[i].equals(type))     list.addElement(allPieces[i]);
  }
  final JList piecesList=new JList(list);
  final JList piecesList2=new JList(emptyList);
  final JButton moveLeft=new JButton();
  moveLeft.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      try {
        int index=piecesList2.getSelectedIndex();
        list.addElement(emptyList.elementAt(index));
        emptyList.remove(index);
      }
 catch (      Exception e) {
      }
    }
  }
);
  moveLeft.setText("String_Node_Str");
  final JButton moveRight=new JButton();
  moveRight.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      int index=piecesList.getSelectedIndex();
      try {
        emptyList.addElement(list.elementAt(index));
        list.remove(index);
      }
 catch (      Exception e) {
      }
    }
  }
);
  moveRight.setText("String_Node_Str");
  piecesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  piecesList.setLayoutOrientation(JList.VERTICAL);
  piecesList.setVisibleRowCount(-1);
  piecesList.setSelectedIndex(0);
  piecesList2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  piecesList2.setLayoutOrientation(JList.VERTICAL);
  piecesList2.setVisibleRowCount(-1);
  piecesList2.setSelectedIndex(0);
  JScrollPane scrollPane=new JScrollPane(piecesList);
  scrollPane.setPreferredSize(new Dimension(200,200));
  ListSelectionModel selectList=piecesList.getSelectionModel();
  selectList.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      if (e.getValueIsAdjusting() == false) {
        if (piecesList.getSelectedIndex() == -1) {
          moveLeft.setEnabled(false);
          moveRight.setEnabled(false);
        }
 else {
          moveLeft.setEnabled(true);
          moveRight.setEnabled(true);
        }
      }
    }
  }
);
  JScrollPane scrollPane2=new JScrollPane(piecesList2);
  scrollPane2.setPreferredSize(new Dimension(200,200));
  ListSelectionModel selectList2=piecesList2.getSelectionModel();
  selectList2.addListSelectionListener(new ListSelectionListener(){
    @Override public void valueChanged(    ListSelectionEvent e){
      if (e.getValueIsAdjusting() == false) {
        if (piecesList2.getSelectedIndex() == -1) {
          moveLeft.setEnabled(false);
          moveRight.setEnabled(false);
        }
 else {
          moveLeft.setEnabled(true);
          moveRight.setEnabled(true);
        }
      }
    }
  }
);
  JButton submitButton=new JButton("String_Node_Str");
  submitButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      ArrayList<String> promotesTo=new ArrayList<String>();
      for (int i=0; i < emptyList.size(); i++) {
        promotesTo.add((String)emptyList.get(i));
      }
      promotions.put(type,promotesTo);
      popup.dispose();
    }
  }
);
  JButton backButton=new JButton("String_Node_Str");
  backButton.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      popup.dispose();
    }
  }
);
  JPanel options=new JPanel();
  options.add(submitButton);
  options.add(backButton);
  JPanel otherCrap=new JPanel();
  otherCrap.setLayout(new GridBagLayout());
  GridBagConstraints c=new GridBagConstraints();
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=1;
  otherCrap.add(moveRight,c);
  c.fill=GridBagConstraints.HORIZONTAL;
  c.gridx=0;
  c.gridy=2;
  otherCrap.add(moveLeft,c);
  c.gridx=0;
  c.gridy=0;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=0;
  c.gridy=1;
  popup.add(scrollPane,c);
  c.gridx=1;
  c.gridy=1;
  popup.add(otherCrap,c);
  c.gridx=2;
  c.gridy=0;
  popup.add(new JLabel("String_Node_Str"),c);
  c.gridx=2;
  c.gridy=1;
  popup.add(scrollPane2,c);
  c.gridx=0;
  c.gridy=2;
  c.gridwidth=3;
  popup.add(options,c);
  popup.setVisible(true);
}