nus-yam/ex-repair huggingface dataset:
Program: 73708
Project: 73708
Buggy source:
/** 
 * Construct a panel associated with the search result.  The panel layout is taken care of in the constructor.  A listener is added for _modelLink, which is a button used to open the model in a new editing frame.
 * @param dbModel The model returned as a search result.
 * @param configuration The configuration under which an effigy of this model would be generated.
 */
public ModelPanel(XMLDBModel dbModel,Configuration configuration){
  setLayout(new FlowLayout(FlowLayout.LEADING));
  setAlignmentX(LEFT_ALIGNMENT);
  setMinimumSize(getMaximumSize());
  Border border=BorderFactory.createEmptyBorder(0,3,0,0);
  setBorder(border);
  _modelName=dbModel.getModelName();
  _configuration=configuration;
  JLabel modelLabel=new JLabel("String_Node_Str");
  add(modelLabel);
  _loadCheck=new JCheckBox();
  _loadCheck.setSelected(false);
  add(_loadCheck);
  _modelLink=new JButton("String_Node_Str" + _modelName + "String_Node_Str");
  _modelLink.setForeground(Color.BLUE);
  _modelLink.setMaximumSize(getMinimumSize());
  add(_modelLink);
  _modelLink.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      _loadModel();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Construct a panel associated with the search result.  The panel layout is taken care of in the constructor.  A listener is added for _modelLink, which is a button used to open the model in a new editing frame.
 * @param dbModel The model returned as a search result.
 * @param configuration The configuration under which an effigy of this model would be generated.
 */
public ModelPanel(XMLDBModel dbModel,Configuration configuration){
  setLayout(new FlowLayout(FlowLayout.LEADING));
  setAlignmentX(LEFT_ALIGNMENT);
  setMaximumSize(new Dimension(getMaximumSize().width,30));
  setMinimumSize(getMaximumSize());
  Border border=BorderFactory.createEmptyBorder(0,3,0,0);
  setBorder(border);
  _modelName=dbModel.getModelName();
  _configuration=configuration;
  JLabel modelLabel=new JLabel("String_Node_Str");
  add(modelLabel);
  _loadCheck=new JCheckBox();
  _loadCheck.setSelected(false);
  add(_loadCheck);
  _modelLink=new JButton("String_Node_Str" + _modelName + "String_Node_Str");
  _modelLink.setForeground(Color.BLUE);
  _modelLink.setMaximumSize(getMinimumSize());
  add(_modelLink);
  _modelLink.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      _loadModel();
    }
  }
);
}
Program: 73709
Project: 73709
Buggy source:
private void _saveModel() throws Exception {
  try {
    _modelToSave.setName(_attributesListPanel.getModelName());
    if (_initialModelName != null && _initialModelName.length() > 0) {
      if (!_modelToSave.getName().equals(_initialModelName)) {
        Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
        int n=JOptionPane.showOptionDialog(this,"String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[2]);
        if (n != JOptionPane.YES_OPTION) {
          return;
        }
 else {
          if (_modelToSave.getAttribute("String_Node_Str") != null) {
            java.util.Date time=new java.util.Date();
            ((StringParameter)_modelToSave.getAttribute("String_Node_Str")).setExpression(_modelToSave.getName() + "String_Node_Str" + String.valueOf(time.getTime()));
            System.out.println("String_Node_Str");
          }
        }
      }
    }
    _commitSave(_isNew());
  }
 catch (  DBConnectionException exception) {
    throw exception;
  }
catch (  DBExecutionException exception) {
    throw exception;
  }
catch (  IllegalArgumentException exception) {
    throw exception;
  }
}

Fixed version (ground truth):
private void _saveModel() throws Exception {
  try {
    _modelToSave.setName(_attributesListPanel.getModelName());
    if (_initialModelName != null && _initialModelName.length() > 0) {
      if (!_modelToSave.getName().equals(_initialModelName)) {
        Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
        int n=JOptionPane.showOptionDialog(this,"String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[2]);
        if (n != JOptionPane.YES_OPTION) {
          return;
        }
      }
    }
    String id=null;
    if (_modelToSave.getAttribute("String_Node_Str") != null) {
      id=((StringParameter)_modelToSave.getAttribute("String_Node_Str")).getExpression();
    }
    _commitSave(_isNew(),id);
  }
 catch (  DBConnectionException exception) {
    throw exception;
  }
catch (  DBExecutionException exception) {
    throw exception;
  }
catch (  IllegalArgumentException exception) {
    throw exception;
  }
}
Program: 73713
Project: 73713
Buggy source:
private void _rollbackModel(){
  try {
    ArrayList<StringParameter> attributesList=new ArrayList();
    for (    Object a : _modelToSave.attributeList()) {
      if (a instanceof StringParameter) {
        attributesList.add((StringParameter)a);
      }
    }
    for (    StringParameter attribute : attributesList) {
      if (attribute.getName() != "String_Node_Str" && attribute.getName() != "String_Node_Str" && attribute.getName() != "String_Node_Str" && _attributesListPanel.isDBAttribute(attribute.getName())) {
        attribute.setContainer(null);
      }
    }
    for (    StringParameter attribute : _orignialAttributes) {
      attribute.setContainer(_modelToSave);
    }
    MoMLChangeRequest change=new MoMLChangeRequest(this,null,_modelToSave.exportMoML());
    change.setUndoable(true);
    _modelToSave.requestChange(change);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
private void _rollbackModel(){
  try {
    ArrayList<StringParameter> attributesList=new ArrayList();
    for (    Object a : _modelToSave.attributeList()) {
      if (a instanceof StringParameter) {
        attributesList.add((StringParameter)a);
      }
    }
    for (    StringParameter attribute : attributesList) {
      if (attribute.getName() != "String_Node_Str" && attribute.getName() != "String_Node_Str" && _attributesListPanel.isDBAttribute(attribute.getName())) {
        attribute.setContainer(null);
      }
    }
    for (    StringParameter attribute : _orignialAttributes) {
      attribute.setContainer(_modelToSave);
    }
    MoMLChangeRequest change=new MoMLChangeRequest(this,null,_modelToSave.exportMoML());
    change.setUndoable(true);
    _modelToSave.requestChange(change);
  }
 catch (  Exception e) {
  }
}
Program: 73714
Project: 73714
Buggy source:
private boolean updateCache(XMLDBModel xmlDBModel) throws DBConnectionException, DBExecutionException {
  boolean isSuccessful=false;
  ArrayList<XMLDBModel> hierarchy=new ArrayList();
  ArrayList<XMLDBModel> modelsToRemoveList=new ArrayList();
  DBConnection dbConnection=null;
  try {
    dbConnection=DBConnectorFactory.getSyncConnection(false);
    ArrayList<XMLDBModel> modelList=new ArrayList();
    modelList.add(xmlDBModel);
    FetchHierarchyTask fetchHierarchyTask=new FetchHierarchyTask();
    fetchHierarchyTask.setModelsList(modelList);
    hierarchy=dbConnection.executeFetchHierarchyTask(fetchHierarchyTask);
    if (hierarchy != null && hierarchy.size() > 0) {
      if (hierarchy.get(0) != null) {
        if (hierarchy.get(0).getParents() != null) {
          for (          List<XMLDBModel> branch : hierarchy.get(0).getParents()) {
            for (            XMLDBModel modelToRemove : branch) {
              if (!modelsToRemoveList.contains(modelToRemove)) {
                modelsToRemoveList.add(modelToRemove);
              }
            }
          }
        }
      }
    }
  }
 catch (  DBExecutionException dbEx) {
    throw dbEx;
  }
 finally {
    if (dbConnection != null) {
      dbConnection.closeConnection();
    }
  }
  modelsToRemoveList.add(xmlDBModel);
  HashSet set=new HashSet();
  for (int i=0; i < modelsToRemoveList.size(); i++) {
    boolean val=set.add(modelsToRemoveList.get(i).getModel());
    if (val == false) {
      modelsToRemoveList.remove(i);
    }
  }
  isSuccessful=CacheManager.removeFromCache(hierarchy);
  return isSuccessful;
}

Fixed version (ground truth):
private void updateCache(XMLDBModel xmlDBModel) throws DBConnectionException, DBExecutionException {
  ArrayList<XMLDBModel> hierarchy=new ArrayList();
  ArrayList<XMLDBModel> modelsToRemoveList=new ArrayList();
  DBConnection dbConnection=null;
  try {
    dbConnection=DBConnectorFactory.getSyncConnection(false);
    ArrayList<XMLDBModel> modelList=new ArrayList();
    modelList.add(xmlDBModel);
    FetchHierarchyTask fetchHierarchyTask=new FetchHierarchyTask();
    fetchHierarchyTask.setModelsList(modelList);
    hierarchy=dbConnection.executeFetchHierarchyTask(fetchHierarchyTask);
    if (hierarchy != null && hierarchy.size() > 0) {
      if (hierarchy.get(0) != null) {
        if (hierarchy.get(0).getParents() != null) {
          for (          List<XMLDBModel> branch : hierarchy.get(0).getParents()) {
            for (            XMLDBModel modelToRemove : branch) {
              if (!modelsToRemoveList.contains(modelToRemove)) {
                modelsToRemoveList.add(modelToRemove);
              }
            }
          }
        }
      }
    }
  }
 catch (  DBExecutionException dbEx) {
    throw dbEx;
  }
 finally {
    if (dbConnection != null) {
      dbConnection.closeConnection();
    }
  }
  modelsToRemoveList.add(xmlDBModel);
  HashSet set=new HashSet();
  for (int i=0; i < modelsToRemoveList.size(); i++) {
    boolean val=set.add(modelsToRemoveList.get(i).getModel());
    if (val == false) {
      modelsToRemoveList.remove(i);
    }
  }
  CacheManager.removeFromCache(hierarchy);
}
Program: 73716
Project: 73716
Buggy source:
/** 
 * Test the SaveManager.save() method. <p> The condition for this test case: <br>- The model being saved is an existing model and should be updated in the database. </p>
 * @exception Exception Thrown if the test fails and the exception was nothandled.
 */
@Test public void testSave_SaveModel() throws Exception {
  SaveModelManager saveManager=new SaveModelManager();
  PowerMock.mockStatic(DBConnectorFactory.class);
  DBConnection dBConnectionMock=PowerMock.createMock(DBConnection.class);
  EasyMock.expect(DBConnectorFactory.getSyncConnection(true)).andReturn(dBConnectionMock);
  XMLDBModel modelMock=PowerMock.createPartialMock(XMLDBModel.class,"String_Node_Str");
  EasyMock.expect(modelMock.getIsNew()).andReturn(false);
  SaveModelTask saveModelTaskMock=PowerMock.createMock(SaveModelTask.class);
  PowerMock.expectNew(SaveModelTask.class,modelMock).andReturn(saveModelTaskMock);
  dBConnectionMock.executeSaveModelTask(saveModelTaskMock);
  dBConnectionMock.commitConnection();
  dBConnectionMock.closeConnection();
  PowerMock.replayAll();
  boolean isSuccess=saveManager.save(modelMock);
  assertTrue(isSuccess);
  PowerMock.verifyAll();
}

Fixed version (ground truth):
/** 
 * Test the SaveManager.save() method. <p> The condition for this test case: <br>- The model being saved is an existing model and should be updated in the database. </p>
 * @exception Exception Thrown if the test fails and the exception was nothandled.
 */
@Test public void testSave_SaveModel() throws Exception {
  SaveModelManager saveManager=new SaveModelManager();
  PowerMock.mockStatic(DBConnectorFactory.class);
  DBConnection dBConnectionMock=PowerMock.createMock(DBConnection.class);
  EasyMock.expect(DBConnectorFactory.getSyncConnection(true)).andReturn(dBConnectionMock);
  XMLDBModel modelMock=PowerMock.createPartialMock(XMLDBModel.class,"String_Node_Str");
  EasyMock.expect(modelMock.getIsNew()).andReturn(false);
  SaveModelTask saveModelTaskMock=PowerMock.createMock(SaveModelTask.class);
  PowerMock.expectNew(SaveModelTask.class,modelMock).andReturn(saveModelTaskMock);
  EasyMock.expect(dBConnectionMock.executeSaveModelTask(saveModelTaskMock)).andReturn("String_Node_Str");
  dBConnectionMock.commitConnection();
  dBConnectionMock.closeConnection();
  PowerMock.replayAll();
  boolean isSuccess=(saveManager.save(modelMock) != null);
  assertTrue(isSuccess);
  PowerMock.verifyAll();
}
Program: 73717
Project: 73717
Buggy source:
/** 
 * Test the SaveManager.save() method. <p> The condition for this test case:<br/> - The model being saved is a new model and should be created in the database. </p>
 * @exception Exception Thrown if the test fails and the exception was nothandled.
 */
@Test public void testSave_CreateModel() throws Exception {
  SaveModelManager saveManager=new SaveModelManager();
  PowerMock.mockStatic(DBConnectorFactory.class);
  DBConnection dBConnectionMock=PowerMock.createMock(DBConnection.class);
  EasyMock.expect(DBConnectorFactory.getSyncConnection(true)).andReturn(dBConnectionMock);
  XMLDBModel modelMock=PowerMock.createPartialMock(XMLDBModel.class,"String_Node_Str");
  EasyMock.expect(modelMock.getIsNew()).andReturn(true);
  CreateModelTask createModelTaskMock=PowerMock.createMock(CreateModelTask.class);
  PowerMock.expectNew(CreateModelTask.class,modelMock).andReturn(createModelTaskMock);
  dBConnectionMock.executeCreateModelTask(createModelTaskMock);
  dBConnectionMock.commitConnection();
  dBConnectionMock.closeConnection();
  PowerMock.replayAll();
  boolean isSuccess=saveManager.save(modelMock);
  assertTrue(isSuccess);
  PowerMock.verifyAll();
}

Fixed version (ground truth):
/** 
 * Test the SaveManager.save() method. <p> The condition for this test case:<br/> - The model being saved is a new model and should be created in the database. </p>
 * @exception Exception Thrown if the test fails and the exception was nothandled.
 */
@Test public void testSave_CreateModel() throws Exception {
  SaveModelManager saveManager=new SaveModelManager();
  PowerMock.mockStatic(DBConnectorFactory.class);
  DBConnection dBConnectionMock=PowerMock.createMock(DBConnection.class);
  EasyMock.expect(DBConnectorFactory.getSyncConnection(true)).andReturn(dBConnectionMock);
  XMLDBModel modelMock=PowerMock.createPartialMock(XMLDBModel.class,"String_Node_Str");
  EasyMock.expect(modelMock.getIsNew()).andReturn(true);
  CreateModelTask createModelTaskMock=PowerMock.createMock(CreateModelTask.class);
  PowerMock.expectNew(CreateModelTask.class,modelMock).andReturn(createModelTaskMock);
  EasyMock.expect(dBConnectionMock.executeCreateModelTask(createModelTaskMock)).andReturn("String_Node_Str");
  dBConnectionMock.commitConnection();
  dBConnectionMock.closeConnection();
  PowerMock.replayAll();
  boolean isSuccess=(saveManager.save(modelMock) != null);
  assertTrue(isSuccess);
  PowerMock.verifyAll();
}
Program: 73718
Project: 73718
Buggy source:
/** 
 * Given a model name, load a model from the cache.
 * @param modelName The name of the model to be loaded form the cache.
 * @return An XMLDBModel populated with the model's MoML string.
 * @exception DBConnectionException Thrown if a problem occurs with the cache connection.
 * @exception DBExecutionException Thrown if a problem occurs retrieving the  MoML from the database.
 */
public static XMLDBModel loadFromCache(String modelName) throws DBConnectionException, DBExecutionException {
  XMLDBModel returnXMLDBModel=null;
  DBConnection dbConnection=null;
  try {
    if (modelName.equals(null)) {
      throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
    }
    dbConnection=DBConnectorFactory.getCacheConnection(false);
    if (dbConnection == null) {
      throw new DBConnectionException("String_Node_Str");
    }
    GetModelTask getModelTask=new GetModelTask(modelName);
    returnXMLDBModel=dbConnection.executeGetModelTask(getModelTask);
  }
 catch (  DBExecutionException e) {
    throw e;
  }
 finally {
    if (dbConnection != null) {
      dbConnection.closeConnection();
    }
  }
  return returnXMLDBModel;
}

Fixed version (ground truth):
/** 
 * Given a model name, load a model from the cache.
 * @param modelName The name of the model to be loaded form the cache.
 * @return An XMLDBModel populated with the model's MoML string.
 * @exception DBConnectionException Thrown if a problem occurs with the cache connection.
 * @exception DBExecutionException Thrown if a problem occurs retrieving the  MoML from the database.
 */
public static XMLDBModel loadFromCache(String modelName) throws DBConnectionException, DBExecutionException {
  XMLDBModel returnXMLDBModel=null;
  DBConnection dbConnection=null;
  try {
    if (modelName == null) {
      throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
    }
    dbConnection=DBConnectorFactory.getCacheConnection(false);
    if (dbConnection == null) {
      throw new DBConnectionException("String_Node_Str");
    }
    GetModelTask getModelTask=new GetModelTask(modelName);
    returnXMLDBModel=dbConnection.executeGetModelTask(getModelTask);
  }
 catch (  DBExecutionException e) {
    throw e;
  }
 finally {
    if (dbConnection != null) {
      dbConnection.closeConnection();
    }
  }
  return returnXMLDBModel;
}
Program: 73725
Project: 73725
Buggy source:
@Override protected boolean _isSearchCriteriaSet(){
  if (_commandSearchCriteria != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean _isSearchCriteriaSet(){
  if (_commandSearchCriteria == null || _commandSearchCriteria.equals("String_Node_Str")) {
    return false;
  }
  return true;
}
Program: 73726
Project: 73726
Buggy source:
@Override protected boolean _isSearchCriteriaSet(){
  if (_dbGraphSearchCriteria != null) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean _isSearchCriteriaSet(){
  if (_dbGraphSearchCriteria != null && (!_dbGraphSearchCriteria.getPortsList().isEmpty() || !_dbGraphSearchCriteria.getComponentEntitiesList().isEmpty() || !_dbGraphSearchCriteria.getCompositeEntities().isEmpty())) {
    return true;
  }
  return false;
}
Program: 73728
Project: 73728
Buggy source:
private boolean _isValid() throws NameDuplicationException, IllegalActionException {
  if (_attributesListPanel.getModelName().length() == 0) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.getModelName().matches("String_Node_Str")) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (_attributesListPanel.containsDuplicates()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.allAttributeNamesSet()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (_attributesListPanel.allAttributeValuesSet()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean _isValid() throws NameDuplicationException, IllegalActionException {
  if (_attributesListPanel.getModelName().length() == 0) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.getModelName().matches("String_Node_Str")) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (_attributesListPanel.containsDuplicates()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.allAttributeNamesSet()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.allAttributeValuesSet()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  return true;
}
Program: 73729
Project: 73729
Buggy source:
/** 
 * Get an indication if all attributes in the panel have names.
 * @return An indication if all attributes in the panel have names. (true they do. false if they do not).
 */
public boolean allAttributeNamesSet(){
  Component[] componentArray1=_attListPanel.getComponents();
  for (int i=0; i < componentArray1.length; i++) {
    if (componentArray1[i] instanceof JPanel) {
      Component[] componentArray2=((JPanel)componentArray1[i]).getComponents();
      for (int j=0; j < componentArray2.length; j++) {
        if (componentArray2[j] instanceof ModelAttributePanel) {
          if (((ModelAttributePanel)componentArray2[j]).getAttributeName().length() <= 0) {
            return false;
          }
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Get an indication if all attributes in the panel have names.
 * @return An indication if all attributes in the panel have names. (true they do. false if they do not).
 */
public boolean allAttributeNamesSet(){
  Component[] componentArray1=_attListPanel.getComponents();
  for (int i=0; i < componentArray1.length; i++) {
    if (componentArray1[i] instanceof JPanel) {
      Component[] componentArray2=((JPanel)componentArray1[i]).getComponents();
      for (int j=0; j < componentArray2.length; j++) {
        if (componentArray2[j] instanceof ModelAttributePanel) {
          if (((ModelAttributePanel)componentArray2[j]).getAttributeName().equals("String_Node_Str")) {
            return false;
          }
        }
      }
    }
  }
  return true;
}
Program: 73730
Project: 73730
Buggy source:
/** 
 * Get the value of this attribute.
 * @return The string value of the attribute, It is obtained from the applicable form Component based on the type mapped to the selected attribute.
 * @see #setValue
 */
public String getValue(){
  if (((XMLDBAttribute)_attributeMap.get(_attributeName.getSelectedItem().toString())).getAttributeType().equals(XMLDBAttribute.ATTRIBUTE_TYPE_STRING)) {
    return _textValue.getText();
  }
 else   if (((XMLDBAttribute)_attributeMap.get(_attributeName.getSelectedItem().toString())).getAttributeType().equals(XMLDBAttribute.ATTRIBUTE_TYPE_LIST)) {
    if (_listValue.getSelectedItem() != null) {
      return _listValue.getSelectedItem().toString();
    }
 else {
      return "String_Node_Str";
    }
  }
 else   if (((XMLDBAttribute)_attributeMap.get(_attributeName.getSelectedItem().toString())).getAttributeType().equals(XMLDBAttribute.ATTRIBUTE_TYPE_BOOLEAN)) {
    if (_booleanValue.isSelected()) {
      return "String_Node_Str";
    }
 else {
      return "String_Node_Str";
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Get the value of this attribute.
 * @return The string value of the attribute, It is obtained from the applicable form Component based on the type mapped to the selected attribute.
 * @see #setValue
 */
public String getValue(){
  try {
    if (((XMLDBAttribute)_attributeMap.get(_attributeName.getSelectedItem().toString())).getAttributeType().equals(XMLDBAttribute.ATTRIBUTE_TYPE_STRING)) {
      return _textValue.getText();
    }
 else     if (((XMLDBAttribute)_attributeMap.get(_attributeName.getSelectedItem().toString())).getAttributeType().equals(XMLDBAttribute.ATTRIBUTE_TYPE_LIST)) {
      if (_listValue.getSelectedItem() != null) {
        return _listValue.getSelectedItem().toString();
      }
 else {
        return "String_Node_Str";
      }
    }
 else     if (((XMLDBAttribute)_attributeMap.get(_attributeName.getSelectedItem().toString())).getAttributeType().equals(XMLDBAttribute.ATTRIBUTE_TYPE_BOOLEAN)) {
      if (_booleanValue.isSelected()) {
        return "String_Node_Str";
      }
 else {
        return "String_Node_Str";
      }
    }
 else {
      return "String_Node_Str";
    }
  }
 catch (  NullPointerException e) {
    return "String_Node_Str";
  }
}
Program: 73731
Project: 73731
Buggy source:
private boolean _isValid() throws NameDuplicationException, IllegalActionException {
  if (_attributesListPanel.getModelName().length() == 0) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.getModelName().matches("String_Node_Str")) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (_attributesListPanel.containsDuplicates()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.allAttributeNamesSet()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean _isValid() throws NameDuplicationException, IllegalActionException {
  if (_attributesListPanel.getModelName().length() == 0) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.getModelName().matches("String_Node_Str")) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (_attributesListPanel.containsDuplicates()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (!_attributesListPanel.allAttributeNamesSet()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  if (_attributesListPanel.allAttributeValuesSet()) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE,null);
    return false;
  }
  return true;
}
Program: 73733
Project: 73733
Buggy source:
private void _importByValue(){
  ArrayList<String> modelNames=new ArrayList();
  for (  SearchResultPanel panel : _resultPanelList) {
    modelNames.addAll(panel.getSelections());
  }
  for (  String modelName : modelNames) {
    try {
      Entity modelToImport=LoadManager.importModel(modelName,false);
      if (modelToImport != null) {
        MoMLChangeRequest change=new MoMLChangeRequest(this,_containerModel,modelToImport.exportMoML());
        change.setUndoable(true);
        _containerModel.requestChange(change);
      }
 else {
        throw new Exception();
      }
    }
 catch (    Exception e) {
      MessageHandler.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void _importByValue(){
  ArrayList<String> modelNames=new ArrayList();
  for (  SearchResultPanel panel : _resultPanelList) {
    modelNames.addAll(panel.getSelections());
  }
  for (  String modelName : modelNames) {
    try {
      Entity modelToImport=LoadManager.importModel(modelName,false,_containerModel);
      if (modelToImport != null) {
        MoMLChangeRequest change=new MoMLChangeRequest(this,_containerModel,modelToImport.exportMoML());
        change.setUndoable(true);
        _containerModel.requestChange(change);
      }
 else {
        throw new Exception();
      }
    }
 catch (    Exception e) {
      MessageHandler.error("String_Node_Str",e);
    }
  }
}
Program: 73734
Project: 73734
Buggy source:
private void _importByReference(){
  ArrayList<String> modelNames=new ArrayList();
  for (  SearchResultPanel panel : _resultPanelList) {
    modelNames.addAll(panel.getSelections());
  }
  for (  String modelName : modelNames) {
    try {
      Entity modelToImport=LoadManager.importModel(modelName,true);
      if (modelToImport != null) {
        MoMLChangeRequest change=new MoMLChangeRequest(this,_containerModel,modelToImport.exportMoML());
        change.setUndoable(true);
        _containerModel.requestChange(change);
      }
 else {
        throw new Exception();
      }
    }
 catch (    Exception e) {
      MessageHandler.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void _importByReference(){
  ArrayList<String> modelNames=new ArrayList();
  for (  SearchResultPanel panel : _resultPanelList) {
    modelNames.addAll(panel.getSelections());
  }
  for (  String modelName : modelNames) {
    try {
      Entity modelToImport=LoadManager.importModel(modelName,true,_containerModel);
      if (modelToImport != null) {
        MoMLChangeRequest change=new MoMLChangeRequest(this,_containerModel,modelToImport.exportMoML());
        change.setUndoable(true);
        _containerModel.requestChange(change);
      }
 else {
        throw new Exception();
      }
    }
 catch (    Exception e) {
      MessageHandler.error("String_Node_Str",e);
    }
  }
}
Program: 73737
Project: 73737
Buggy source:
/** 
 * create a setup parameter object that contains the database setup parameters and return that setup parameter object to the caller.
 * @return The setup parameter object.
 */
public static SetupParameters getSetupParameters(){
  if (_isDBSetupDone == true) {
    SetupParameters setupParameters=new SetupParameters(_DB_URL,_dbContainerName,_cacheContainerName);
    return setupParameters;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * create a setup parameter object that contains the database setup parameters and return that setup parameter object to the caller.
 * @return The setup parameter object.
 */
public static SetupParameters getSetupParameters(){
  if (_isDBSetupDone == true) {
    SetupParameters setupParameters=new SetupParameters(_dbUrl,_dbContainerName,_cacheContainerName);
    return setupParameters;
  }
 else {
    return null;
  }
}
Program: 73738
Project: 73738
Buggy source:
/** 
 * Test the database connection with the parameters given.
 * @param params The parameters for the database connection. 
 * @exception DBConnectionException Thrown if the connection fails.
 */
public void testConnection(SetupParameters params) throws DBConnectionException {
  if (params == null) {
    throw new DBConnectionException("String_Node_Str" + "String_Node_Str");
  }
  String url=params.getUrl();
  String containerName=params.getContainerName();
  String cacheContainerName=params.getCacheContainerName();
  DBConnectionParameters dbMainConnParams=new DBConnectionParameters(url,containerName,false);
  DBConnectionParameters dbCacheConnParams=new DBConnectionParameters(url,cacheContainerName,false);
  try {
    DBConnection mainConnection=new OracleXMLDBConnection(dbMainConnParams);
    if (mainConnection == null) {
      throw new DBConnectionException("String_Node_Str" + "String_Node_Str" + url + "String_Node_Str"+ containerName);
    }
 else {
      mainConnection.closeConnection();
    }
    DBConnection cacheConnection=new OracleXMLDBConnection(dbCacheConnParams);
    if (cacheConnection == null) {
      throw new DBConnectionException("String_Node_Str" + "String_Node_Str" + url + "String_Node_Str"+ cacheContainerName);
    }
 else {
      cacheConnection.closeConnection();
    }
  }
 catch (  DBConnectionException e) {
    throw new DBConnectionException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Test the database connection with the parameters given.
 * @param params The parameters for the database connection.
 * @exception DBConnectionException Thrown if the connection fails.
 */
public void testConnection(SetupParameters params) throws DBConnectionException {
  if (params == null) {
    throw new DBConnectionException("String_Node_Str" + "String_Node_Str");
  }
  String url=params.getUrl();
  String containerName=params.getContainerName();
  String cacheContainerName=params.getCacheContainerName();
  DBConnectionParameters dbMainConnParams=new DBConnectionParameters(url,containerName,false);
  DBConnectionParameters dbCacheConnParams=new DBConnectionParameters(url,cacheContainerName,false);
  try {
    DBConnection mainConnection=new OracleXMLDBConnection(dbMainConnParams);
    mainConnection.closeConnection();
    DBConnection cacheConnection=new OracleXMLDBConnection(dbCacheConnParams);
    cacheConnection.closeConnection();
  }
 catch (  DBConnectionException e) {
    throw new DBConnectionException("String_Node_Str" + "String_Node_Str" + e.getMessage(),e);
  }
}
Program: 73739
Project: 73739
Buggy source:
/** 
 * Update the existing database connection parameters with the given parameters.
 * @param params The new database connection parameters.
 * @exception DBConnectionException Thrown if the connection fails.
 * @exception IOException Thrown if an error occurs while writing the newparameters.
 */
public void updateConnection(SetupParameters params) throws DBConnectionException, IOException {
  if (params == null) {
    throw new DBConnectionException("String_Node_Str" + "String_Node_Str");
  }
  String ptdbParams="String_Node_Str";
  Properties props=new Properties();
  File propertiesFile=new File(ptdbParams);
  URL url=null;
  if (propertiesFile.exists() == false) {
    propertiesFile.createNewFile();
    url=FileUtilities.nameToURL(ptdbParams,null,null);
  }
 else {
    url=FileUtilities.nameToURL(ptdbParams,null,null);
  }
  if (url == null) {
    throw new IOException("String_Node_Str" + ptdbParams);
  }
  props.setProperty("String_Node_Str",params.getUrl());
  props.setProperty("String_Node_Str",params.getContainerName());
  props.setProperty("String_Node_Str",params.getCacheContainerName());
  props.store(url.openConnection().getOutputStream(),null);
  DBConnectorFactory.loadDBProperties();
}

Fixed version (ground truth):
/** 
 * Update the existing database connection parameters with the given parameters.
 * @param params The new database connection parameters.
 * @exception DBConnectionException Thrown if the connection fails.
 * @exception IOException Thrown if an error occurs while writing the newparameters.
 */
public void updateConnection(SetupParameters params) throws DBConnectionException, IOException {
  if (params == null) {
    throw new DBConnectionException("String_Node_Str" + "String_Node_Str");
  }
  String ptdbParams=DBConnectorFactory._PROPERTIES_FILE_PATH;
  Properties props=new Properties();
  File file=FileUtilities.nameToFile(ptdbParams,null);
  if (file.exists() == false) {
    file.createNewFile();
  }
  URL url=FileUtilities.nameToURL(ptdbParams,null,null);
  if (url == null) {
    throw new IOException("String_Node_Str" + ptdbParams);
  }
  String defaultDBClassName="String_Node_Str";
  props.load(url.openStream());
  String DBClassName=(String)props.getProperty(DBConnectorFactory._DB_CLASS_NAME);
  if (DBClassName == null || DBClassName.length() == 0) {
    DBClassName=defaultDBClassName;
  }
  props.setProperty(DBConnectorFactory._DB_CLASS_NAME,DBClassName);
  props.setProperty(DBConnectorFactory._DB_URL,params.getUrl());
  props.setProperty(DBConnectorFactory._XMLDB_CONTAINER_NAME,params.getContainerName());
  props.setProperty(DBConnectorFactory._CACHE_CONTAINER_NAME,params.getCacheContainerName());
  props.store(new FileOutputStream(url.getPath()),null);
  DBConnectorFactory.loadDBProperties();
}
Program: 73740
Project: 73740
Buggy source:
/** 
 * Create a graph with dependencies caused by sequence numbers and data flow constraints.
 * @param All sequence attributes to be considered when building the graph.
 */
private void _createGraph(List<SequenceAttribute> independentList){
  _initSequenceEstimation();
  CompositeEntity composite=(CompositeEntity)_director.getContainer();
  Iterator entities=composite.deepEntityList().iterator();
  while (entities.hasNext()) {
    Actor actor=(Actor)entities.next();
    Node actorNode=(Node)_actorNodeMap.get(actor);
    HashSet preds=_getPredecessors(independentList,actor);
    int numPreds=preds.size();
    Iterator predsIterator=preds.iterator();
    while (predsIterator.hasNext()) {
      Actor pred=(Actor)predsIterator.next();
      if (pred == composite) {
        numPreds--;
      }
 else {
        Node predNode=(Node)_actorNodeMap.get(pred);
        _graph.addEdge(predNode,actorNode);
      }
    }
    _unscheduledPredecessors.put(actorNode,new Integer(numPreds));
    if (numPreds == 0) {
      _ready.add(actorNode);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create a graph with dependencies caused by sequence numbers and data flow constraints.
 * @param independentList All sequence attributes to be considered when building the graph.
 */
private void _createGraph(List<SequenceAttribute> independentList){
  _initSequenceEstimation();
  CompositeEntity composite=(CompositeEntity)_director.getContainer();
  Iterator entities=composite.deepEntityList().iterator();
  while (entities.hasNext()) {
    Actor actor=(Actor)entities.next();
    Node actorNode=(Node)_actorNodeMap.get(actor);
    HashSet preds=_getPredecessors(independentList,actor);
    int numPreds=preds.size();
    Iterator predsIterator=preds.iterator();
    while (predsIterator.hasNext()) {
      Actor pred=(Actor)predsIterator.next();
      if (pred == composite) {
        numPreds--;
      }
 else {
        Node predNode=(Node)_actorNodeMap.get(pred);
        _graph.addEdge(predNode,actorNode);
      }
    }
    _unscheduledPredecessors.put(actorNode,Integer.valueOf(numPreds));
    if (numPreds == 0) {
      _ready.add(actorNode);
    }
  }
}
Program: 73741
Project: 73741
Buggy source:
public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  Actor actor=null;
  if (value instanceof Actor) {
    actor=(Actor)value;
  }
  if (actor != null) {
    String name=actor.getDisplayName();
    List<SequenceAttribute> seqAttributes=((Entity)actor).attributeList(SequenceAttribute.class);
    if (seqAttributes.size() > 0) {
      name+="String_Node_Str" + seqAttributes.get(0).getSequenceNumber() + "String_Node_Str";
    }
    this.setText(name);
  }
  return this;
}

Fixed version (ground truth):
public Component getListCellRendererComponent(JList list,Object value,int index,boolean isSelected,boolean cellHasFocus){
  super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
  Actor actor=null;
  if (value instanceof Actor) {
    actor=(Actor)value;
  }
  if (actor != null) {
    String name=actor.getDisplayName();
    List<SequenceAttribute> seqAttributes=((Entity)actor).attributeList(SequenceAttribute.class);
    if (seqAttributes.size() > 0) {
      try {
        name+="String_Node_Str" + seqAttributes.get(0).getSequenceNumber() + "String_Node_Str";
      }
 catch (      IllegalActionException e) {
        MessageHandler.error("String_Node_Str" + actor.getName() + "String_Node_Str",e);
      }
    }
    this.setText(name);
  }
  return this;
}
Program: 73742
Project: 73742
Buggy source:
/** 
 * Get the size of the array in memory this token is pointing to. Do  not check, if the array in the memory is of that size.
 * @return The size of the array in memory this token is pointing to.
 */
public int getSize(){
  return _size;
}

Fixed version (ground truth):
/** 
 * Get the size of the array in memory this token is pointing to. Do  not check, if the array in the memory is of that size.
 * @see #setSize(int)
 * @return The size of the array in memory this token is pointing to.
 */
public int getSize(){
  return _size;
}
Program: 73743
Project: 73743
Buggy source:
/** 
 * Set the size of the array in memory this token is pointing to. Do not  change the actual content or size of the memory nor the array in the memory.
 * @param size The size of the array in memory this token is pointing to.
 */
public void setSize(int size){
  this._size=size;
}

Fixed version (ground truth):
/** 
 * Set the size of the array in memory this token is pointing to. Do not  change the actual content or size of the memory nor the array in the memory.
 * @see #getSize()
 * @param size The size of the array in memory this token is pointing to.
 */
public void setSize(int size){
  this._size=size;
}
Program: 73744
Project: 73744
Buggy source:
/** 
 * Set the address in memory this token should point to. Do not change the position of the array in the memory.
 * @param addr The address in memory this token should point to.
 */
public void setAddress(int addr){
  this._addr=addr;
}

Fixed version (ground truth):
/** 
 * Set the address in memory this token should point to. Do not change the position of the array in the memory.
 * @see #getAddress()
 * @param addr The address in memory this token should point to.
 */
public void setAddress(int addr){
  this._addr=addr;
}
Program: 73745
Project: 73745
Buggy source:
/** 
 * Get the address in memory this token is pointing to. Do  not check, if there actually is something at that memory address.
 * @return The address in memory this token is pointing to.
 */
public int getAddress(){
  return _addr;
}

Fixed version (ground truth):
/** 
 * Get the address in memory this token is pointing to. Do  not check, if there actually is something at that memory address.
 * @see #setAddress(int)
 * @return The address in memory this token is pointing to.
 */
public int getAddress(){
  return _addr;
}
Program: 73746
Project: 73746
Buggy source:
protected void _init() throws IllegalActionException, NameDuplicationException {
  super._init();
  if (_memory == null) {
    _memory=new Memory();
  }
  iterations.setExpression("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Initialize the shared memory for the actors and set the  iterations for this director to one.
 * @throws IllegalActionException If there is a problem instantiatingthe director's parameters.
 * @throws NameDuplicationException If there is a problem instantiatingthe director's parameters.
 */
protected void _init() throws IllegalActionException, NameDuplicationException {
  super._init();
  if (_memory == null) {
    _memory=new Memory();
  }
  iterations.setExpression("String_Node_Str");
}
Program: 73747
Project: 73747
Buggy source:
protected void _setInitialValues() throws IllegalActionException {
  _clearReceivers();
}

Fixed version (ground truth):
/** 
 * Set the initial Tokens present on the inputs of the actors. In this case do not set any initial tokens. Remove already present tokens.
 * @throws IllegalActionException If already present tokens cannot beremoved.
 */
protected void _setInitialValues() throws IllegalActionException {
  _clearReceivers();
}
Program: 73748
Project: 73748
Buggy source:
/** 
 * Read the PtrToken present on <i>input</i> and produce a new PtrToken on <i>output</i> with address = address of the token present <i>input</i>  plus addressOffset and size = size of the token present at <i>input</i> plus sizeOffset.
 * @throws NoTokenException If there is no token.
 * @throws IllegalActionException If there is no director, and henceno receivers have been created, if the port is not an input port, or if the channel index is out of range.
 */
public void fire() throws NoTokenException, IllegalActionException {
  Token token=input.get(0);
  if (token instanceof PtrToken) {
    PtrToken in=(PtrToken)token;
    addressOffset.update();
    int addr=in.getAddress() + ((IntToken)addressOffset.getToken()).intValue();
    sizeOffset.update();
    int sz=in.getSize() + +((IntToken)sizeOffset.getToken()).intValue();
    if (sz < 1) {
      new IllegalActionException("String_Node_Str");
    }
    PtrToken result=new PtrToken(addr,sz);
    output.broadcast(result);
  }
  return;
}

Fixed version (ground truth):
/** 
 * Read the PtrToken present on <i>input</i> and produce a new PtrToken on <i>output</i> with address = address of the token present <i>input</i>  plus addressOffset and size = size of the token present at <i>input</i> plus sizeOffset.
 * @throws NoTokenException If there is no token.
 * @throws IllegalActionException If there is no director, and henceno receivers have been created, if the port is not an input port, or if the channel index is out of range.
 */
public void fire() throws NoTokenException, IllegalActionException {
  Token token=input.get(0);
  if (token instanceof PtrToken) {
    PtrToken in=(PtrToken)token;
    addressOffset.update();
    int addr=in.getAddress() + ((IntToken)addressOffset.getToken()).intValue();
    sizeOffset.update();
    int sz=in.getSize() + +((IntToken)sizeOffset.getToken()).intValue();
    if (sz < 1) {
      throw new IllegalActionException("String_Node_Str");
    }
    PtrToken result=new PtrToken(addr,sz);
    output.broadcast(result);
  }
  return;
}
Program: 73749
Project: 73749
Buggy source:
/** 
 * Allocate a slot in the memory (currently at the end)
 * @param size The size of the slot to be allocated.
 * @return A pointer to the address allocated in the memory.
 */
public PtrToken allocate(int size){
  int addr=_buffer.size();
  _buffer.setSize(addr + size);
  PtrToken result=new PtrToken(addr,size);
  return result;
}

Fixed version (ground truth):
/** 
 * Allocate a slot in the memory (currently at the end).
 * @param size The size of the slot to be allocated.
 * @return A pointer to the address allocated in the memory.
 */
public PtrToken allocate(int size){
  int addr=_buffer.size();
  _buffer.setSize(addr + size);
  PtrToken result=new PtrToken(addr,size);
  return result;
}
Program: 73750
Project: 73750
Buggy source:
/** 
 * Remove all entries from the memory 
 */
public void clear(){
  _buffer.clear();
}

Fixed version (ground truth):
/** 
 * Remove all entries from the memory. 
 */
public void clear(){
  _buffer.clear();
}
Program: 73751
Project: 73751
Buggy source:
/** 
 * Set the attribute list value only when the attribute type is list
 * @param attributeValues The list of attribute values.
 * @see #getAttributeValue
 */
public void setAttributeValue(List<String> attributeValues){
  if (_attributeType.equals(XMLDBAttribute.ATTRIBUTE_TYPE_LIST)) {
    _attributeValues=attributeValues;
  }
}

Fixed version (ground truth):
/** 
 * Set the attribute list value only when the attribute type is list.
 * @param attributeValues The list of attribute values.
 * @see #getAttributeValue
 */
public void setAttributeValue(List<String> attributeValues){
  if (_attributeType.equals(XMLDBAttribute.ATTRIBUTE_TYPE_LIST)) {
    _attributeValues=attributeValues;
  }
}
Program: 73752
Project: 73752
Buggy source:
/** 
 * Construct a XMLDBAttribute instance with the given attribute name.
 * @param attributeName the name for the given attribute.
 */
public XMLDBAttribute(String attributeName,String attributeType){
  this._attributeName=attributeName;
  this._attributeType=attributeType;
}

Fixed version (ground truth):
/** 
 * Construct a XMLDBAttribute instance with the given attribute name.
 * @param attributeName The name for the given attribute.
 * @param attributeType The type for the given attribute.
 */
public XMLDBAttribute(String attributeName,String attributeType){
  this._attributeName=attributeName;
  this._attributeType=attributeType;
}
Program: 73753
Project: 73753
Buggy source:
/** 
 * Set the parents for the current model
 * @param listParents List of parents for this model.
 * @see #getParents
 */
public void setParents(List<List<XMLDBModel>> listParents){
  _listParents=listParents;
}

Fixed version (ground truth):
/** 
 * Set the parents for the current model.
 * @param listParents List of parents for this model.
 * @see #getParents
 */
public void setParents(List<List<XMLDBModel>> listParents){
  _listParents=listParents;
}
Program: 73754
Project: 73754
Buggy source:
public PushMatrix(GraphicsDirector director){
  _director=director;
}

Fixed version (ground truth):
public PushMatrix(JoglDirector director){
  _director=director;
}