Program: 73630
Project: 73630
Buggy source:
/** 
 * Execute the given task to update the referenced version for the given  parents from the old model to the new model. 
 * @param task Task that contains the list of parents, the old model and the new model.
 * @throws DBExecutionException If thrown while updating the parents in the database.
 */
public void executeUpdateParentsToNewVersion(UpdateParentsToNewVersionTask task) throws DBExecutionException {
  if (task.getNewModel() == null || task.getOldModel() == null || task.getParentsList() == null) {
    throw new DBExecutionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  String newModelId=task.getNewModel().getModelId();
  String newModelName=task.getNewModel().getModelName();
  if (newModelId == null || newModelId.length() == 0) {
    newModelId=_getModelIdFromModelName(newModelName);
  }
  String oldModelId=task.getOldModel().getModelId();
  String oldModelName=task.getOldModel().getModelName();
  if (oldModelId == null || oldModelId.length() == 0) {
    oldModelId=_getModelIdFromModelName(oldModelName);
  }
  String propertyString=Utilities.getPropertyString(XMLDBModel.DB_MODEL_ID_ATTR,newModelId);
  for (  String parentName : task.getParentsList()) {
    String parentsQuery="String_Node_Str" + _params.getContainerName() + "String_Node_Str"+ parentName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_REFERENCE_ATTR+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ XMLDBModel.DB_MODEL_ID_ATTR+ "String_Node_Str"+ "String_Node_Str"+ oldModelId+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ propertyString;
    try {
      XmlQueryContext xmlQueryContext=_xmlManager.createQueryContext();
      _xmlManager.query(_xmlTransaction,parentsQuery,xmlQueryContext,null);
    }
 catch (    XmlException e) {
      throw new DBExecutionException("String_Node_Str" + e.getMessage(),e);
    }
    String referenceString=_getModelReferences(newModelId);
    String referenceFileQuery="String_Node_Str" + _params.getContainerName() + "String_Node_Str"+ "String_Node_Str"+ parentName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ oldModelName+ "String_Node_Str"+ referenceString;
    try {
      XmlQueryContext xmlQueryContext=_xmlManager.createQueryContext();
      _xmlManager.query(_xmlTransaction,referenceFileQuery,xmlQueryContext,null);
    }
 catch (    XmlException e) {
      throw new DBExecutionException("String_Node_Str" + e.getMessage(),e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Execute the given task to update the referenced version for the given  parents from the old model to the new model. 
 * @param task Task that contains the list of parents, the old model and the new model.
 * @throws DBExecutionException If thrown while updating the parents in the database.
 */
public void executeUpdateParentsToNewVersion(UpdateParentsToNewVersionTask task) throws DBExecutionException {
  if (task.getNewModel() == null || task.getOldModel() == null || task.getParentsList() == null) {
    throw new DBExecutionException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  String newModelId=task.getNewModel().getModelId();
  String newModelName=task.getNewModel().getModelName();
  if (newModelId == null || newModelId.length() == 0) {
    newModelId=_getModelIdFromModelName(newModelName);
  }
  String oldModelId=task.getOldModel().getModelId();
  String oldModelName=task.getOldModel().getModelName();
  if (oldModelId == null || oldModelId.length() == 0) {
    oldModelId=_getModelIdFromModelName(oldModelName);
  }
  for (  String parentName : task.getParentsList()) {
    GetModelTask getModelTask=new GetModelTask(parentName);
    XmlDocument parentModelDoc=_getModelFromDB(getModelTask);
    String parentModelContent;
    try {
      parentModelContent=parentModelDoc.getContentAsString();
    }
 catch (    XmlException e1) {
      throw new DBExecutionException("String_Node_Str" + parentName);
    }
    parentModelContent=parentModelContent.replaceAll("String_Node_Str" + oldModelId + "String_Node_Str","String_Node_Str" + newModelId + "String_Node_Str");
    XMLDBModel parentModel=new XMLDBModel(parentName);
    parentModel.setModel(parentModelContent);
    executeUpdateModelInCache(parentModel);
    String referenceString=_getModelReferences(newModelId);
    String referenceFileQuery="String_Node_Str" + _params.getContainerName() + "String_Node_Str"+ "String_Node_Str"+ parentName+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ oldModelName+ "String_Node_Str"+ referenceString;
    try {
      XmlQueryContext xmlQueryContext=_xmlManager.createQueryContext();
      _xmlManager.query(_xmlTransaction,referenceFileQuery,xmlQueryContext,null);
    }
 catch (    XmlException e) {
      throw new DBExecutionException("String_Node_Str" + e.getMessage(),e);
    }
  }
}