Program: 73388
Project: 73388
Buggy source:
/** 
 * Construct a SaveModelToDBFrame. Add swing Components to the frame. Add listeners for the "Save" and "Cancel" buttons.
 * @param model The model that is being saved to the database.
 * @param source The source frame.  Used to set modified to false uponsuccessful save.
 */
public SaveModelToDBFrame(NamedObj model,ActorGraphDBFrame source){
  super("String_Node_Str");
  setLayout(new BoxLayout(this.getContentPane(),BoxLayout.Y_AXIS));
  _source=source;
  _modelToSave=model;
  _initialModelName=model.getName();
  _orignialAttributes=new ArrayList();
  _attributesListPanel=new AttributesListPanel(_modelToSave);
  _tabbedPane=new JTabbedPane();
  try {
    if (!_isNew()) {
      _xmlModel=new XMLDBModel(_modelToSave.getName());
      _xmlModel.setModelId(Utilities.getIdFromModel(_modelToSave));
    }
  }
 catch (  NameDuplicationException e1) {
  }
catch (  IllegalActionException e1) {
  }
  for (  Object attribute : _modelToSave.attributeList()) {
    if (attribute instanceof StringParameter) {
      if (!((StringParameter)attribute).getName().equals(XMLDBModel.DB_REFERENCE_ATTR) && !((StringParameter)attribute).getName().equals(XMLDBModel.DB_MODEL_ID_ATTR) && _attributesListPanel.isDBAttribute(((StringParameter)attribute).getName())) {
        _orignialAttributes.add((StringParameter)attribute);
      }
    }
  }
  JPanel topPanel=new JPanel();
  JPanel bottomPanel=new JPanel();
  _attributesListPanel.setAlignmentX(LEFT_ALIGNMENT);
  _tabbedPane.setAlignmentX(LEFT_ALIGNMENT);
  topPanel.setAlignmentX(LEFT_ALIGNMENT);
  bottomPanel.setAlignmentX(LEFT_ALIGNMENT);
  _attributesListPanel.setAlignmentY(TOP_ALIGNMENT);
  _tabbedPane.setAlignmentY(TOP_ALIGNMENT);
  topPanel.setAlignmentY(TOP_ALIGNMENT);
  bottomPanel.setAlignmentY(TOP_ALIGNMENT);
  topPanel.setLayout(new BoxLayout(topPanel,BoxLayout.Y_AXIS));
  _tabbedPane.setLayout(new BoxLayout(_tabbedPane,BoxLayout.Y_AXIS));
  topPanel.setBorder(BorderFactory.createEmptyBorder());
  _tabbedPane.addTab("String_Node_Str",_attributesListPanel);
  _tabbedPane.setMnemonicAt(0,KeyEvent.VK_1);
  _tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
  _saveButton=new JButton("String_Node_Str");
  _cancelButton=new JButton("String_Node_Str");
  _nextButton=new JButton("String_Node_Str");
  _saveButton.setMnemonic(KeyEvent.VK_ENTER);
  _cancelButton.setMnemonic(KeyEvent.VK_ESCAPE);
  _nextButton.setMnemonic(KeyEvent.VK_RIGHT);
  _saveButton.setActionCommand("String_Node_Str");
  _cancelButton.setActionCommand("String_Node_Str");
  _nextButton.setActionCommand("String_Node_Str");
  _saveButton.setHorizontalTextPosition(SwingConstants.CENTER);
  _cancelButton.setHorizontalTextPosition(SwingConstants.CENTER);
  _nextButton.setHorizontalTextPosition(SwingConstants.CENTER);
  for (  Object stringParameter : _modelToSave.attributeList()) {
    if (stringParameter instanceof StringParameter && ((StringParameter)stringParameter).getName() != XMLDBModel.DB_REFERENCE_ATTR && ((StringParameter)stringParameter).getName() != XMLDBModel.DB_MODEL_ID_ATTR && _attributesListPanel.isDBAttribute(((StringParameter)stringParameter).getName())) {
      _attributesListPanel.addAttribute((StringParameter)stringParameter);
    }
  }
  _saveButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      _save();
    }
  }
);
  _cancelButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      _rollbackModel();
      setVisible(false);
      if (_parentValidateFrame != null) {
        _parentValidateFrame.setVisible(false);
      }
    }
  }
);
  _nextButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      if (_parentValidateFrame == null) {
        _parentValidateFrame=new ParentValidateFrame(SaveModelToDBFrame.this);
      }
      _parentValidateFrame.pack();
      _parentValidateFrame.setLocationRelativeTo(SaveModelToDBFrame.this);
      _parentValidateFrame.setVisible(true);
      setVisible(false);
    }
  }
);
  _attributesListPanel.getNameTextField().addKeyListener(new KeyListener(){
    public void keyTyped(    KeyEvent e){
    }
    public void keyReleased(    KeyEvent e){
      if (!_attributesListPanel.getNameTextField().getText().equals(_initialModelName)) {
        _nextButton.setEnabled(false);
        _saveButton.setEnabled(true);
      }
 else {
        _setButtons();
      }
    }
    public void keyPressed(    KeyEvent e){
      if (e.getKeyCode() == KeyEvent.VK_ENTER) {
        if (_saveButton.isEnabled()) {
          _saveButton.getActionListeners()[0].actionPerformed(null);
        }
 else         if (_nextButton.isEnabled()) {
          _nextButton.getActionListeners()[0].actionPerformed(null);
        }
      }
    }
  }
);
  topPanel.add(_tabbedPane);
  bottomPanel.add(_saveButton);
  bottomPanel.add(_cancelButton);
  bottomPanel.add(_nextButton);
  add(topPanel);
  add(bottomPanel);
  validate();
  repaint();
  _setButtons();
  this.pack();
  _attributesListPanel.setModelNameFocus();
}

Fixed version (ground truth):
/** 
 * Construct a SaveModelToDBFrame. Add swing Components to the frame. Add listeners for the "Save" and "Cancel" buttons.
 * @param model The model that is being saved to the database.
 * @param source The source frame.  Used to set modified to false uponsuccessful save.
 */
public SaveModelToDBFrame(NamedObj model,ActorGraphDBFrame source){
  super("String_Node_Str");
  setLayout(new BoxLayout(this.getContentPane(),BoxLayout.Y_AXIS));
  _source=source;
  _modelToSave=model;
  _initialModelName=model.getName();
  _orignialAttributes=new ArrayList();
  _attributesListPanel=new AttributesListPanel(_modelToSave);
  _tabbedPane=new JTabbedPane();
  try {
    if (!_isNew()) {
      _xmlModel=new XMLDBModel(_modelToSave.getName());
      _xmlModel.setModelId(Utilities.getIdFromModel(_modelToSave));
    }
  }
 catch (  NameDuplicationException e1) {
  }
catch (  IllegalActionException e1) {
  }
  for (  Object attribute : _modelToSave.attributeList()) {
    if (attribute instanceof StringParameter) {
      if (!((StringParameter)attribute).getName().equals(XMLDBModel.DB_REFERENCE_ATTR) && !((StringParameter)attribute).getName().equals(XMLDBModel.DB_MODEL_ID_ATTR) && _attributesListPanel.isDBAttribute(((StringParameter)attribute).getName())) {
        _orignialAttributes.add((StringParameter)attribute);
      }
    }
  }
  JPanel topPanel=new JPanel();
  JPanel bottomPanel=new JPanel();
  _attributesListPanel.setAlignmentX(LEFT_ALIGNMENT);
  _tabbedPane.setAlignmentX(LEFT_ALIGNMENT);
  topPanel.setAlignmentX(LEFT_ALIGNMENT);
  bottomPanel.setAlignmentX(LEFT_ALIGNMENT);
  _attributesListPanel.setAlignmentY(TOP_ALIGNMENT);
  _tabbedPane.setAlignmentY(TOP_ALIGNMENT);
  topPanel.setAlignmentY(TOP_ALIGNMENT);
  bottomPanel.setAlignmentY(TOP_ALIGNMENT);
  topPanel.setLayout(new BoxLayout(topPanel,BoxLayout.Y_AXIS));
  _tabbedPane.setLayout(new BoxLayout(_tabbedPane,BoxLayout.Y_AXIS));
  topPanel.setBorder(BorderFactory.createEmptyBorder());
  _tabbedPane.addTab("String_Node_Str",_attributesListPanel);
  _tabbedPane.setMnemonicAt(0,KeyEvent.VK_1);
  _tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
  _saveButton=new JButton("String_Node_Str");
  _cancelButton=new JButton("String_Node_Str");
  _nextButton=new JButton("String_Node_Str");
  _saveButton.setMnemonic(KeyEvent.VK_ENTER);
  _cancelButton.setMnemonic(KeyEvent.VK_ESCAPE);
  _nextButton.setMnemonic(KeyEvent.VK_RIGHT);
  _saveButton.setActionCommand("String_Node_Str");
  _cancelButton.setActionCommand("String_Node_Str");
  _nextButton.setActionCommand("String_Node_Str");
  _saveButton.setHorizontalTextPosition(SwingConstants.CENTER);
  _cancelButton.setHorizontalTextPosition(SwingConstants.CENTER);
  _nextButton.setHorizontalTextPosition(SwingConstants.CENTER);
  for (  Object stringParameter : _modelToSave.attributeList()) {
    if (stringParameter instanceof StringParameter && !((StringParameter)stringParameter).getName().equals(XMLDBModel.DB_REFERENCE_ATTR) && !((StringParameter)stringParameter).getName().equals(XMLDBModel.DB_MODEL_ID_ATTR)&& _attributesListPanel.isDBAttribute(((StringParameter)stringParameter).getName())) {
      _attributesListPanel.addAttribute((StringParameter)stringParameter);
    }
  }
  _saveButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      _save();
    }
  }
);
  _cancelButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      _rollbackModel();
      setVisible(false);
      if (_parentValidateFrame != null) {
        _parentValidateFrame.setVisible(false);
      }
    }
  }
);
  _nextButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent e){
      if (_parentValidateFrame == null) {
        _parentValidateFrame=new ParentValidateFrame(SaveModelToDBFrame.this);
      }
      _parentValidateFrame.pack();
      _parentValidateFrame.setLocationRelativeTo(SaveModelToDBFrame.this);
      _parentValidateFrame.setVisible(true);
      setVisible(false);
    }
  }
);
  _attributesListPanel.getNameTextField().addKeyListener(new KeyListener(){
    public void keyTyped(    KeyEvent e){
    }
    public void keyReleased(    KeyEvent e){
      if (!_attributesListPanel.getNameTextField().getText().equals(_initialModelName)) {
        _nextButton.setEnabled(false);
        _saveButton.setEnabled(true);
      }
 else {
        _setButtons();
      }
    }
    public void keyPressed(    KeyEvent e){
      if (e.getKeyCode() == KeyEvent.VK_ENTER) {
        if (_saveButton.isEnabled()) {
          _saveButton.getActionListeners()[0].actionPerformed(null);
        }
 else         if (_nextButton.isEnabled()) {
          _nextButton.getActionListeners()[0].actionPerformed(null);
        }
      }
    }
  }
);
  topPanel.add(_tabbedPane);
  bottomPanel.add(_saveButton);
  bottomPanel.add(_cancelButton);
  bottomPanel.add(_nextButton);
  add(topPanel);
  add(bottomPanel);
  validate();
  repaint();
  _setButtons();
  this.pack();
  _attributesListPanel.setModelNameFocus();
}