Program: 44821
Project: 44821
Buggy source:
/** 
 * Adds a checkbox menu item for each of the preferred encodings, and a special item that invokes a dialog that allows the list of preferred encodings to be customized.
 */
protected void populateMenu(){
  Vector<String> encodings=EncodingPreferences.getPreferredEncodings();
  if (selectedEncoding != null && !encodings.contains(selectedEncoding))   encodings.insertElementAt(selectedEncoding,0);
  int nbEncodings=encodings.size();
  String enc;
  JCheckBoxMenuItem item;
  ButtonGroup group=new ButtonGroup();
  for (int i=0; i < nbEncodings; i++) {
    enc=encodings.elementAt(i);
    item=new JCheckBoxMenuItem(enc);
    if (selectedEncoding != null && selectedEncoding.equals(enc))     item.setSelected(true);
    item.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        String oldEncoding=selectedEncoding;
        selectedEncoding=((JCheckBoxMenuItem)e.getSource()).getText();
        if (!oldEncoding.equals(selectedEncoding)) {
          fireEncodingListener(oldEncoding,EncodingMenu.this.selectedEncoding);
        }
      }
    }
);
    group.add(item);
    add(item);
  }
  add(new JSeparator());
  JMenuItem customizeItem=new JMenuItem(Translator.get("String_Node_Str") + "String_Node_Str");
  customizeItem.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      Window owner=dialogOwner.getOwner();
      if (owner instanceof Frame)       new PreferredEncodingsDialog((Frame)owner).showDialog();
 else       new PreferredEncodingsDialog((Dialog)owner).showDialog();
      removeAll();
      populateMenu();
    }
  }
);
  add(customizeItem);
}

Fixed version (ground truth):
/** 
 * Adds a checkbox menu item for each of the preferred encodings, and a special item that invokes a dialog that allows the list of preferred encodings to be customized.
 */
protected void populateMenu(){
  java.util.List<String> encodings=EncodingPreferences.getPreferredEncodings();
  if (selectedEncoding != null && !encodings.contains(selectedEncoding))   encodings.add(0,selectedEncoding);
  int nbEncodings=encodings.size();
  JCheckBoxMenuItem item;
  ButtonGroup group=new ButtonGroup();
  for (  String enc : encodings) {
    item=new JCheckBoxMenuItem(enc);
    if (selectedEncoding != null && selectedEncoding.equals(enc))     item.setSelected(true);
    item.addActionListener(new ActionListener(){
      public void actionPerformed(      ActionEvent e){
        String oldEncoding=selectedEncoding;
        selectedEncoding=((JCheckBoxMenuItem)e.getSource()).getText();
        if (!oldEncoding.equals(selectedEncoding)) {
          fireEncodingListener(oldEncoding,EncodingMenu.this.selectedEncoding);
        }
      }
    }
);
    group.add(item);
    add(item);
  }
  add(new JSeparator());
  JMenuItem customizeItem=new JMenuItem(Translator.get("String_Node_Str") + "String_Node_Str");
  customizeItem.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      Window owner=dialogOwner.getOwner();
      if (owner instanceof Frame)       new PreferredEncodingsDialog((Frame)owner).showDialog();
 else       new PreferredEncodingsDialog((Dialog)owner).showDialog();
      removeAll();
      populateMenu();
    }
  }
);
  add(customizeItem);
}