nus-yam/ex-repair huggingface dataset:
Program: 167323
Project: 167323
Buggy source:
protected void refreshProjects(){
  long ts=System.currentTimeMillis();
  Object selected=treeTable.getValue();
  List<Project> projects=configurationService.findProjects();
  treeTable.removeAllItems();
  for (  Project project : projects) {
    List<ProjectVersion> versions=project.getProjectVersions();
    treeTable.addItem(project);
    treeTable.setItemIcon(project,Icons.PROJECT);
    treeTable.setChildrenAllowed(project,versions.size() > 0);
  }
  if (selected == null) {
    String selectedId=context.getUser().findSetting(UserSetting.SETTING_DESIGN_NAVIGATOR_SELECTION_ID).getValue();
    if (isNotBlank(selectedId)) {
      String projectId=context.getUser().findSetting(UserSetting.SETTING_DESIGN_NAVIGATOR_SELECTED_PROJECT_ID).getValue();
      if (isNotBlank(projectId)) {
        Collection<?> items=treeTable.getItemIds();
        for (        Object object : items) {
          if (object instanceof Project && ((Project)object).getId().equals(projectId)) {
            addProjectVersions((Project)object);
            selected=findChild(selectedId,object);
            break;
          }
        }
      }
    }
  }
  selectAndExpand(selected);
  log.info("String_Node_Str",(System.currentTimeMillis() - ts));
}

Fixed version (ground truth):
protected void refreshProjects(){
  long ts=System.currentTimeMillis();
  Object selected=treeTable.getValue();
  List<Project> projects=configurationService.findProjects();
  treeTable.removeAllItems();
  for (  Project project : projects) {
    List<ProjectVersion> versions=project.getProjectVersions();
    treeTable.addItem(project);
    treeTable.setItemIcon(project,Icons.PROJECT);
    treeTable.setChildrenAllowed(project,versions.size() > 0);
  }
  if (selected == null) {
    String selectedId=context.getUser().findSetting(UserSetting.SETTING_DESIGN_NAVIGATOR_SELECTION_ID).getValue();
    if (isNotBlank(selectedId)) {
      String projectId=context.getUser().findSetting(UserSetting.SETTING_DESIGN_NAVIGATOR_SELECTED_PROJECT_ID).getValue();
      if (isNotBlank(projectId)) {
        Collection<?> items=treeTable.getItemIds();
        for (        Object object : items) {
          if (object instanceof Project && ((Project)object).getId().equals(projectId) && !((Project)object).isDeleted()) {
            addProjectVersions((Project)object);
            selected=findChild(selectedId,object);
            break;
          }
        }
      }
    }
  }
  selectAndExpand(selected);
  log.info("String_Node_Str",(System.currentTimeMillis() - ts));
}
Program: 167324
Project: 167324
Buggy source:
protected void selectAndExpand(Object value){
  if (value != null && !treeTable.containsId(value)) {
    String projectVersionId=null;
    if (value instanceof AbstractName) {
      AbstractName named=(AbstractName)value;
      projectVersionId=named.getProjectVersionId();
    }
 else     if (value instanceof ProjectVersion) {
      projectVersionId=((ProjectVersion)value).getId();
    }
    String projectId=null;
    if (isNotBlank(projectVersionId)) {
      ProjectVersion projectVersion=configurationService.findProjectVersion(projectVersionId);
      projectId=projectVersion.getProjectId();
    }
 else     if (value instanceof Project) {
      projectId=((Project)value).getId();
    }
    if (isNotBlank(projectId)) {
      Collection<?> items=treeTable.getItemIds();
      for (      Object object : items) {
        if (object instanceof Project && ((Project)object).getId().equals(projectId)) {
          addProjectVersions(((Project)object));
        }
      }
    }
  }
  treeTable.setValue(value);
  if (value != null) {
    treeTable.setCollapsed(value,false);
    Object parent=treeTable.getParent(value);
    while (parent != null) {
      treeTable.setCollapsed(parent,false);
      parent=treeTable.getParent(parent);
    }
  }
  treeTable.focus();
}

Fixed version (ground truth):
protected void selectAndExpand(Object value){
  if (value != null && !treeTable.containsId(value)) {
    String projectVersionId=null;
    if (value instanceof AbstractName) {
      AbstractName named=(AbstractName)value;
      projectVersionId=named.getProjectVersionId();
    }
 else     if (value instanceof ProjectVersion) {
      projectVersionId=((ProjectVersion)value).getId();
    }
    String projectId=null;
    if (isNotBlank(projectVersionId)) {
      ProjectVersion projectVersion=configurationService.findProjectVersion(projectVersionId);
      projectId=projectVersion.getProjectId();
    }
 else     if (value instanceof Project) {
      projectId=((Project)value).getId();
    }
    if (isNotBlank(projectId)) {
      Collection<?> items=treeTable.getItemIds();
      for (      Object object : items) {
        if (object instanceof Project && ((Project)object).getId().equals(projectId) && !((Project)object).isDeleted()) {
          addProjectVersions(((Project)object));
        }
      }
    }
  }
  treeTable.setValue(value);
  if (value != null) {
    treeTable.setCollapsed(value,false);
    Object parent=treeTable.getParent(value);
    while (parent != null) {
      treeTable.setCollapsed(parent,false);
      parent=treeTable.getParent(parent);
    }
  }
  treeTable.focus();
}
Program: 167325
Project: 167325
Buggy source:
protected void initPlugins(WebApplicationContext ctx){
  InputStream is=ctx.getServletContext().getResourceAsStream("String_Node_Str");
  if (is != null) {
    ZipInputStream zip=null;
    try {
      zip=new ZipInputStream(is);
      ZipEntry entry=null;
      File dir=new File(getConfigDir(false),AppConstants.PLUGINS_DIR);
      for (entry=zip.getNextEntry(); entry != null; entry=zip.getNextEntry()) {
        File f=new File(dir,entry.getName());
        if (!f.exists()) {
          if (entry.isDirectory()) {
            f.mkdirs();
          }
 else {
            getLogger().info("String_Node_Str" + f.getAbsolutePath());
            f.getParentFile().mkdirs();
            OutputStream os=new BufferedOutputStream(new FileOutputStream(f));
            try {
              final byte buffer[]=new byte[4096];
              int readCount;
              while ((readCount=zip.read(buffer)) > 0) {
                os.write(buffer,0,readCount);
              }
            }
  finally {
              os.close();
            }
          }
        }
      }
    }
 catch (    RuntimeException e) {
      throw e;
    }
catch (    Exception e) {
      throw new RuntimeException(e);
    }
 finally {
      IOUtils.closeQuietly(zip);
    }
  }
  ctx.getBean(IPluginManager.class).init();
  ctx.getBean(IDefinitionFactory.class).refresh();
}

Fixed version (ground truth):
protected void initPlugins(WebApplicationContext ctx){
  InputStream is=ctx.getServletContext().getResourceAsStream("String_Node_Str");
  boolean newPluginsUnzipped=false;
  if (is != null) {
    ZipInputStream zip=null;
    try {
      zip=new ZipInputStream(is);
      ZipEntry entry=null;
      File dir=new File(getConfigDir(false),AppConstants.PLUGINS_DIR);
      for (entry=zip.getNextEntry(); entry != null; entry=zip.getNextEntry()) {
        File f=new File(dir,entry.getName());
        if (!f.exists() || (f.getName().startsWith("String_Node_Str") && newPluginsUnzipped)) {
          if (entry.isDirectory()) {
            f.mkdirs();
          }
 else {
            getLogger().info("String_Node_Str" + f.getAbsolutePath());
            newPluginsUnzipped=true;
            f.getParentFile().mkdirs();
            OutputStream os=new BufferedOutputStream(new FileOutputStream(f));
            try {
              final byte buffer[]=new byte[4096];
              int readCount;
              while ((readCount=zip.read(buffer)) > 0) {
                os.write(buffer,0,readCount);
              }
            }
  finally {
              os.close();
            }
          }
        }
      }
    }
 catch (    RuntimeException e) {
      throw e;
    }
catch (    Exception e) {
      throw new RuntimeException(e);
    }
 finally {
      IOUtils.closeQuietly(zip);
    }
  }
  ctx.getBean(IPluginManager.class).init();
  ctx.getBean(IDefinitionFactory.class).refresh();
}
Program: 167326
Project: 167326
Buggy source:
@Override public void start(){
  IResourceRuntime httpResource=getResourceRuntime();
  if (httpResource == null || !(httpResource instanceof Http)) {
    throw new IllegalStateException(String.format("String_Node_Str",Http.TYPE));
  }
  Component component=getComponent();
  bodyFrom=component.get(BODY_FROM,"String_Node_Str");
  bodyText=component.get(BODY_TEXT);
  runWhen=getComponent().get(RUN_WHEN,PER_MESSAGE);
}

Fixed version (ground truth):
@Override public void start(){
  IResourceRuntime httpResource=getResourceRuntime();
  if (httpResource == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  Component component=getComponent();
  bodyFrom=component.get(BODY_FROM,"String_Node_Str");
  bodyText=component.get(BODY_TEXT);
  runWhen=getComponent().get(RUN_WHEN,PER_MESSAGE);
}
Program: 167328
Project: 167328
Buggy source:
public static InputStream getComponentImageInputStream(String projectVersionId,String type,ApplicationContext context){
  String icon="String_Node_Str";
  XMLComponentUI definition=context.getUiFactory().getUiDefinition(projectVersionId,type);
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  InputStream is=null;
  if (definition != null && isNotBlank(definition.getIconImage())) {
    try {
      icon=definition.getIconImage();
      classLoader=definition.getClassLoader();
      final Enumeration<URL> systemResources=classLoader.getResources(icon);
      while (systemResources.hasMoreElements()) {
        URL url=systemResources.nextElement();
        is=url.openStream();
        break;
      }
    }
 catch (    IOException e) {
    }
  }
  if (is == null) {
    is=UiUtils.class.getResourceAsStream(icon);
  }
  return is;
}

Fixed version (ground truth):
public static InputStream getComponentImageInputStream(String projectVersionId,String type,ApplicationContext context){
  XMLComponentUI definition=context.getUiFactory().getUiDefinition(projectVersionId,type);
  ClassLoader classLoader=Thread.currentThread().getContextClassLoader();
  InputStream is=null;
  if (definition != null && isNotBlank(definition.getIconImage())) {
    String icon=definition.getIconImage();
    classLoader=definition.getClassLoader();
    is=classLoader.getResourceAsStream(icon);
    if (is == null && icon.startsWith("String_Node_Str")) {
      is=classLoader.getResourceAsStream(icon.substring(1));
    }
    if (is == null && !icon.startsWith("String_Node_Str")) {
      is=classLoader.getResourceAsStream("String_Node_Str" + icon);
    }
  }
  if (is == null) {
    is=UiUtils.class.getResourceAsStream("String_Node_Str");
  }
  return is;
}
Program: 167330
Project: 167330
Buggy source:
@Override public InputStream getInputStream(String relativePath,boolean mustExist,boolean closeSession){
  return null;
}

Fixed version (ground truth):
@Override public InputStream getInputStream(String relativePath,boolean mustExist,boolean closeSession,Map<String,String> headers,Map<String,String> parameters){
  return getInputStream(relativePath,mustExist,closeSession);
}
Program: 167331
Project: 167331
Buggy source:
@Override public OutputStream getOutputStream(String relativePath,boolean mustExist,boolean closeSession,boolean append){
  return getOutputStream(relativePath,mustExist);
}

Fixed version (ground truth):
@Override public OutputStream getOutputStream(String relativePath,boolean mustExist,boolean closeSession,boolean append){
  return getOutputStream(relativePath,mustExist,closeSession,append,null,null);
}
Program: 167332
Project: 167332
Buggy source:
public String getResponse(){
  return response.toString();
}

Fixed version (ground truth):
@Override public String getResponse(){
  return response.toString();
}
Program: 167333
Project: 167333
Buggy source:
protected AbstractSelect createResourceCombo(XMLSetting definition,AbstractObjectWithSettings obj,ResourceCategory category){
  FlowStep step=getSingleFlowStep();
  String projectVersionId=step.getComponent().getProjectVersionId();
  final AbstractSelect combo=new ComboBox(definition.getName());
  combo.setImmediate(true);
  combo.setDescription(definition.getDescription());
  combo.setNullSelectionAllowed(false);
  combo.setRequired(definition.isRequired());
  Set<String> types=context.getDefinitionFactory().getResourceCategories(projectVersionId);
  if (types != null) {
    List<Resource> resources=context.getConfigurationService().findResourcesByTypes(projectVersionId,types.toArray(new String[types.size()]));
    if (resources != null) {
      for (      Resource resource : resources) {
        combo.addItem(resource.getId());
        combo.setItemCaption(resource.getId(),resource.getName());
      }
      combo.setValue(obj.get(definition.getId()));
    }
  }
  combo.addValueChangeListener(event -> saveSetting(definition.getId(),(String)combo.getValue(),obj));
  combo.setReadOnly(readOnly);
  return combo;
}

Fixed version (ground truth):
protected AbstractSelect createResourceCombo(XMLSetting definition,AbstractObjectWithSettings obj,ResourceCategory category){
  FlowStep step=getSingleFlowStep();
  String projectVersionId=step.getComponent().getProjectVersionId();
  final AbstractSelect combo=new ComboBox(definition.getName());
  combo.setImmediate(true);
  combo.setDescription(definition.getDescription());
  combo.setNullSelectionAllowed(false);
  combo.setRequired(definition.isRequired());
  Set<XMLResourceDefinition> types=context.getDefinitionFactory().getResourceDefinitions(projectVersionId,category);
  if (types != null) {
    String[] typeStrings=new String[types.size()];
    int i=0;
    for (    XMLResourceDefinition type : types) {
      typeStrings[i++]=type.getId();
    }
    List<Resource> resources=context.getConfigurationService().findResourcesByTypes(projectVersionId,typeStrings);
    if (resources != null) {
      for (      Resource resource : resources) {
        combo.addItem(resource.getId());
        combo.setItemCaption(resource.getId(),resource.getName());
      }
      combo.setValue(obj.get(definition.getId()));
    }
  }
  combo.addValueChangeListener(event -> saveSetting(definition.getId(),(String)combo.getValue(),obj));
  combo.setReadOnly(readOnly);
  return combo;
}
Program: 167335
Project: 167335
Buggy source:
public PluginManager(String localRepositoryPath,IConfigurationService configurationService){
  this.localRepositoryPath=localRepositoryPath;
  this.configurationService=configurationService;
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",1));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",2));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",3));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",4));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",5));
}

Fixed version (ground truth):
public PluginManager(String localRepositoryPath,IConfigurationService configurationService){
  this.localRepositoryPath=localRepositoryPath;
  this.configurationService=configurationService;
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",10));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",20));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",30));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",40));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",50));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",60));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",70));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",80));
  outOfTheBox.add(new Plugin("String_Node_Str","String_Node_Str",90));
}
Program: 167337
Project: 167337
Buggy source:
public void refresh(){
  Object selected=treeTable.getValue();
  List<Object> expandedItems=new ArrayList<Object>();
  Collection<?> items=treeTable.getItemIds();
  for (  Object object : items) {
    if (!treeTable.isCollapsed(object)) {
      expandedItems.add(object);
    }
  }
  treeTable.removeAllItems();
  treeTable.addItem(CURRENTLY_RUNNING);
  treeTable.setChildrenAllowed(CURRENTLY_RUNNING,false);
  treeTable.setItemIcon(CURRENTLY_RUNNING,FontAwesome.GEARS);
  treeTable.addItem(agentsFolder);
  treeTable.setItemIcon(agentsFolder,FontAwesome.FOLDER);
  List<Folder> folders=context.getConfigurationService().findFolders(null,FolderType.AGENT);
  for (  Folder folder : folders) {
    addChildFolder(folder,agentsFolder);
  }
  treeTable.addItem(flowsFolder);
  treeTable.setItemIcon(flowsFolder,FontAwesome.FOLDER);
  addFlowsToFolder(flowsFolder);
  for (  Object object : expandedItems) {
    treeTable.setCollapsed(object,false);
  }
  treeTable.focus();
  if (treeTable.containsId(selected)) {
    treeTable.setValue(selected);
  }
 else {
    treeTable.setValue(CURRENTLY_RUNNING);
  }
}

Fixed version (ground truth):
public void refresh(){
  Object selected=treeTable.getValue();
  List<Object> expandedItems=new ArrayList<Object>();
  Collection<?> items=treeTable.getItemIds();
  for (  Object object : items) {
    if (!treeTable.isCollapsed(object)) {
      expandedItems.add(object);
    }
  }
  treeTable.removeAllItems();
  treeTable.addItem(CURRENTLY_RUNNING);
  treeTable.setChildrenAllowed(CURRENTLY_RUNNING,false);
  treeTable.setItemIcon(CURRENTLY_RUNNING,FontAwesome.GEARS);
  treeTable.addItem(IN_ERROR);
  treeTable.setChildrenAllowed(IN_ERROR,false);
  treeTable.setItemIcon(IN_ERROR,FontAwesome.WARNING);
  treeTable.addItem(agentsFolder);
  treeTable.setItemIcon(agentsFolder,FontAwesome.FOLDER);
  List<Folder> folders=context.getConfigurationService().findFolders(null,FolderType.AGENT);
  for (  Folder folder : folders) {
    addChildFolder(folder,agentsFolder);
  }
  treeTable.addItem(flowsFolder);
  treeTable.setItemIcon(flowsFolder,FontAwesome.FOLDER);
  addFlowsToFolder(flowsFolder);
  for (  Object object : expandedItems) {
    treeTable.setCollapsed(object,false);
  }
  treeTable.focus();
  if (treeTable.containsId(selected)) {
    treeTable.setValue(selected);
  }
 else {
    treeTable.setValue(CURRENTLY_RUNNING);
  }
}
Program: 167339
Project: 167339
Buggy source:
public GroupEditPanel(ApplicationContext context,Group group){
  this.context=context;
  this.group=group;
  FormLayout layout=new FormLayout();
  TextField nameField=new TextField("String_Node_Str",StringUtils.trimToEmpty(group.getName()));
  nameField.addValueChangeListener(new NameChangeListener());
  layout.addComponent(nameField);
  nameField.focus();
  CheckBox readOnly=new CheckBox("String_Node_Str");
  readOnly.setImmediate(true);
  readOnly.setValue(group.isReadOnly());
  readOnly.addValueChangeListener(new ReadOnlyChangeListener());
  layout.addComponent(readOnly);
  TwinColSelect privSelect=new TwinColSelect();
  for (  Privilege priv : Privilege.values()) {
    privSelect.addItem(priv.name());
  }
  lastPrivs=new HashSet<String>();
  for (  GroupPrivilege groupPriv : group.getGroupPrivileges()) {
    lastPrivs.add(groupPriv.getName());
  }
  privSelect.setValue(lastPrivs);
  privSelect.setRows(20);
  privSelect.setNullSelectionAllowed(true);
  privSelect.setMultiSelect(true);
  privSelect.setImmediate(true);
  privSelect.setLeftColumnCaption("String_Node_Str");
  privSelect.setRightColumnCaption("String_Node_Str");
  privSelect.addValueChangeListener(new PrivilegeChangeListener());
  layout.addComponent(privSelect);
  addComponent(layout);
  setMargin(true);
}

Fixed version (ground truth):
public GroupEditPanel(ApplicationContext context,Group group){
  this.context=context;
  this.group=group;
  FormLayout layout=new FormLayout();
  TextField nameField=new TextField("String_Node_Str",StringUtils.trimToEmpty(group.getName()));
  nameField.addValueChangeListener(new NameChangeListener());
  layout.addComponent(nameField);
  nameField.focus();
  readOnly=new CheckBox("String_Node_Str");
  readOnly.setEnabled(isNotBlank(group.getName()));
  readOnly.setImmediate(true);
  readOnly.setValue(group.isReadOnly());
  readOnly.addValueChangeListener(new ReadOnlyChangeListener());
  layout.addComponent(readOnly);
  privSelect=new TwinColSelect();
  privSelect.setEnabled(isNotBlank(group.getName()));
  for (  Privilege priv : Privilege.values()) {
    privSelect.addItem(priv.name());
  }
  lastPrivs=new HashSet<String>();
  for (  GroupPrivilege groupPriv : group.getGroupPrivileges()) {
    lastPrivs.add(groupPriv.getName());
  }
  privSelect.setValue(lastPrivs);
  privSelect.setRows(20);
  privSelect.setNullSelectionAllowed(true);
  privSelect.setMultiSelect(true);
  privSelect.setImmediate(true);
  privSelect.setLeftColumnCaption("String_Node_Str");
  privSelect.setRightColumnCaption("String_Node_Str");
  privSelect.addValueChangeListener(new PrivilegeChangeListener());
  layout.addComponent(privSelect);
  addComponent(layout);
  setMargin(true);
}
Program: 167340
Project: 167340
Buggy source:
public String getErrorText(List<Throwable> allErrors){
  StringBuilder sb=new StringBuilder();
  int count=0;
  for (  Throwable error : allErrors) {
    if (++count < 10) {
      sb.append(ExceptionUtils.getStackTrace(error)).append("String_Node_Str");
    }
 else {
      sb.append("String_Node_Str").append(allErrors.size() - 10).append("String_Node_Str");
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
public String getErrorText(List<Throwable> allErrors){
  StringBuilder sb=new StringBuilder();
  int count=0;
  for (  Throwable error : allErrors) {
    if (++count < 10) {
      sb.append(ExceptionUtils.getStackTrace(error)).append("String_Node_Str");
    }
 else {
      sb.append("String_Node_Str").append(allErrors.size() - 10).append("String_Node_Str");
      break;
    }
  }
  return sb.toString();
}
Program: 167341
Project: 167341
Buggy source:
private void importModelConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)importData.getModelData().get(0).getTableData().get(0).get("String_Node_Str");
  List<TableData> existingModelData=new ArrayList<TableData>();
  initConfigData(existingModelData,MODEL_SQL);
  for (  LinkedCaseInsensitiveMap<Object> row : importData.getModelData().get(0).getTableData()) {
    addConfigData(existingModelData,MODEL_SQL,projectVersionId,(String)row.get(MODEL_SQL[0][2]));
  }
  for (int i=0; i <= MODEL_SQL.length - 1; i++) {
    TableData importModelData=importData.modelData.get(i);
    processConfigTableData(importData,existingModelData.get(i),importModelData,MODEL_SQL[i][2],transaction);
  }
}

Fixed version (ground truth):
private void importModelConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)getOneRow(importData.getModelData().get(MODEL_IDX)).get("String_Node_Str");
  List<TableData> existingModelData=new ArrayList<TableData>();
  initConfigData(existingModelData,MODEL_SQL);
  Iterator<String> itr=importData.getModelData().get(MODEL_IDX).getTableData().keySet().iterator();
  while (itr.hasNext()) {
    String key=itr.next();
    LinkedCaseInsensitiveMap<Object> row=importData.getModelData().get(MODEL_IDX).getTableData().get(key);
    addConfigData(existingModelData,MODEL_SQL,projectVersionId,(String)row.get(MODEL_SQL[MODEL_IDX][KEY_COLUMNS]));
  }
  for (int i=0; i <= MODEL_SQL.length - 1; i++) {
    TableData importModelData=importData.modelData.get(i);
    processConfigTableData(importData,existingModelData.get(i),importModelData,MODEL_SQL[i][KEY_COLUMNS],transaction);
  }
}
Program: 167342
Project: 167342
Buggy source:
private void importConfiguration(ConfigData configData){
  ImportConfigData importData=new ImportConfigData(configData);
  ISqlTransaction transaction=databasePlatform.getSqlTemplate().startSqlTransaction();
  if (importData.getProjectData().size() > 0 && importData.getProjectData().get(0).rows.size() > 0) {
    importProjectConfiguration(importData,transaction);
  }
  if (importData.getResourceData().size() > 0 && importData.getResourceData().get(0).rows.size() > 0) {
    importResourceConfiguration(importData,transaction);
  }
  if (importData.getModelData().size() > 0 && importData.getModelData().get(0).rows.size() > 0) {
    importModelConfiguration(importData,transaction);
  }
  if (importData.getFlowData().size() > 0 && importData.getFlowData().get(0).rows.size() > 0) {
    importFlowConfiguration(importData,transaction);
  }
  processDeletes(importData,transaction);
  transaction.commit();
}

Fixed version (ground truth):
private void importConfiguration(ConfigData configData){
  ImportConfigData importData=new ImportConfigData(configData);
  ISqlTransaction transaction=databasePlatform.getSqlTemplate().startSqlTransaction();
  if (importData.getProjectData().size() > 0 && importData.getProjectData().get(PROJECT_IDX).rows.size() > 0) {
    importProjectConfiguration(importData,transaction);
  }
  if (importData.getResourceData().size() > 0 && importData.getResourceData().get(RESOURCE_IDX).rows.size() > 0) {
    importResourceConfiguration(importData,transaction);
  }
  if (importData.getModelData().size() > 0 && importData.getModelData().get(MODEL_IDX).rows.size() > 0) {
    importModelConfiguration(importData,transaction);
  }
  if (importData.getFlowData().size() > 0 && importData.getFlowData().get(FLOW_IDX).rows.size() > 0) {
    importFlowConfiguration(importData,transaction);
  }
  processDeletes(importData,transaction);
  transaction.commit();
}
Program: 167343
Project: 167343
Buggy source:
private TableData findUpdates(TableData existingData,TableData newData,String primaryKeyColumns){
  boolean found;
  String[] pkCols=StringUtils.split(primaryKeyColumns);
  TableData updates=new TableData(newData.tableName);
  if (existingData.rows.size() > 0 && pkCols.length + 1 < existingData.rows.get(0).size()) {
    for (    LinkedCaseInsensitiveMap<Object> newRow : newData.getTableData()) {
      String newPk=getPkDataAsString(newRow,primaryKeyColumns);
      found=false;
      for (      LinkedCaseInsensitiveMap<Object> existingRow : existingData.getTableData()) {
        String existingPk=getPkDataAsString(existingRow,primaryKeyColumns);
        if (newPk.equalsIgnoreCase(existingPk)) {
          found=true;
        }
      }
      if (found) {
        updates.getTableData().add(newRow);
      }
    }
  }
  return updates;
}

Fixed version (ground truth):
private TableData findUpdates(TableData existingData,TableData newData,String primaryKeyColumns){
  boolean found;
  String[] pkCols=StringUtils.split(primaryKeyColumns);
  TableData updates=new TableData(newData.tableName);
  Iterator<String> itr=existingData.getTableData().keySet().iterator();
  int size=0;
  while (itr.hasNext()) {
    String key=itr.next();
    size=existingData.getTableData().get(key).size();
  }
  if (existingData.rows.size() > 0 && pkCols.length + 1 < size) {
    Iterator<String> newRowItr=newData.getTableData().keySet().iterator();
    while (newRowItr.hasNext()) {
      String newPk=newRowItr.next();
      LinkedCaseInsensitiveMap<Object> newRow=newData.getTableData().get(newPk);
      found=false;
      Iterator<String> existingRowItr=existingData.getTableData().keySet().iterator();
      while (existingRowItr.hasNext()) {
        String existingPk=existingRowItr.next();
        if (newPk.equalsIgnoreCase(existingPk)) {
          found=true;
        }
      }
      if (found) {
        updates.getTableData().put(newPk,newRow);
      }
    }
  }
  return updates;
}
Program: 167344
Project: 167344
Buggy source:
private void importResourceConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)importData.getResourceData().get(0).getTableData().get(0).get("String_Node_Str");
  List<TableData> existingResourceData=new ArrayList<TableData>();
  initConfigData(existingResourceData,RESOURCE_SQL);
  for (  LinkedCaseInsensitiveMap<Object> row : importData.getResourceData().get(0).getTableData()) {
    addConfigData(existingResourceData,RESOURCE_SQL,projectVersionId,(String)row.get(RESOURCE_SQL[0][2]));
  }
  for (int i=0; i <= RESOURCE_SQL.length - 1; i++) {
    TableData importResourceData=importData.resourceData.get(i);
    processConfigTableData(importData,existingResourceData.get(i),importResourceData,RESOURCE_SQL[i][2],transaction);
  }
}

Fixed version (ground truth):
private void importResourceConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)getOneRow(importData.getResourceData().get(RESOURCE_IDX)).get("String_Node_Str");
  List<TableData> existingResourceData=new ArrayList<TableData>();
  initConfigData(existingResourceData,RESOURCE_SQL);
  Iterator<String> itr=importData.getResourceData().get(RESOURCE_IDX).getTableData().keySet().iterator();
  while (itr.hasNext()) {
    String key=itr.next();
    LinkedCaseInsensitiveMap<Object> row=importData.getResourceData().get(RESOURCE_IDX).getTableData().get(key);
    addConfigData(existingResourceData,RESOURCE_SQL,projectVersionId,(String)row.get(RESOURCE_SQL[RESOURCE_IDX][KEY_COLUMNS]));
  }
  for (int i=0; i <= RESOURCE_SQL.length - 1; i++) {
    TableData importResourceData=importData.resourceData.get(i);
    processConfigTableData(importData,existingResourceData.get(i),importResourceData,RESOURCE_SQL[i][KEY_COLUMNS],transaction);
  }
}
Program: 167345
Project: 167345
Buggy source:
private void processTableDeletes(TableData deletes,ISqlTransaction transaction){
  if (deletes != null) {
    Table table=databasePlatform.getTableFromCache(null,null,deletes.getTableName(),false);
    excludeColumns(table);
    DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.DELETE,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),getUpdateColumns(table),null,null,true);
    for (    LinkedCaseInsensitiveMap<Object> row : deletes.getTableData()) {
      transaction.prepareAndExecute(stmt.getSql(),row);
    }
  }
}

Fixed version (ground truth):
private void processTableDeletes(TableData deletes,ISqlTransaction transaction){
  if (deletes != null) {
    Table table=databasePlatform.getTableFromCache(null,null,deletes.getTableName(),false);
    excludeColumns(table);
    DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.DELETE,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),getUpdateColumns(table),null,null,true);
    Iterator<String> itr=deletes.getTableData().keySet().iterator();
    while (itr.hasNext()) {
      String key=itr.next();
      LinkedCaseInsensitiveMap<Object> row=deletes.getTableData().get(key);
      transaction.prepareAndExecute(stmt.getSql(),row);
    }
  }
}
Program: 167346
Project: 167346
Buggy source:
private void processTableUpdates(TableData updates,ISqlTransaction transaction){
  Table table=databasePlatform.getTableFromCache(null,null,updates.getTableName(),false);
  excludeColumns(table);
  DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.UPDATE,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),getUpdateColumns(table),null,null,true);
  for (  LinkedCaseInsensitiveMap<Object> row : updates.getTableData()) {
    transaction.prepareAndExecute(stmt.getSql(),row);
  }
}

Fixed version (ground truth):
private void processTableUpdates(TableData updates,ISqlTransaction transaction){
  Table table=databasePlatform.getTableFromCache(null,null,updates.getTableName(),false);
  excludeColumns(table);
  DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.UPDATE,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),getUpdateColumns(table),null,null,true);
  Iterator<String> itr=updates.getTableData().keySet().iterator();
  while (itr.hasNext()) {
    String key=itr.next();
    LinkedCaseInsensitiveMap<Object> row=updates.getTableData().get(key);
    transaction.prepareAndExecute(stmt.getSql(),row);
  }
}
Program: 167347
Project: 167347
Buggy source:
private TableData findDeletes(TableData existingData,TableData newData,String primaryKeyColumns){
  boolean found;
  TableData deletes=new TableData(newData.tableName);
  for (  LinkedCaseInsensitiveMap<Object> existingRow : existingData.getTableData()) {
    String existingPk=getPkDataAsString(existingRow,primaryKeyColumns);
    found=false;
    for (    LinkedCaseInsensitiveMap<Object> newRow : newData.getTableData()) {
      String newPk=getPkDataAsString(newRow,primaryKeyColumns);
      if (newPk.equalsIgnoreCase(existingPk)) {
        found=true;
      }
    }
    if (!found) {
      deletes.getTableData().add(existingRow);
    }
  }
  return deletes;
}

Fixed version (ground truth):
private TableData findDeletes(TableData existingData,TableData newData,String primaryKeyColumns){
  boolean found;
  TableData deletes=new TableData(newData.tableName);
  Iterator<String> existingRowItr=existingData.getTableData().keySet().iterator();
  while (existingRowItr.hasNext()) {
    String existingPk=existingRowItr.next();
    LinkedCaseInsensitiveMap<Object> existingRow=existingData.getTableData().get(existingPk);
    found=false;
    Iterator<String> newRowItr=newData.getTableData().keySet().iterator();
    while (newRowItr.hasNext()) {
      String newPk=newRowItr.next();
      if (newPk.equalsIgnoreCase(existingPk)) {
        found=true;
      }
    }
    if (!found) {
      deletes.getTableData().put(existingPk,existingRow);
    }
  }
  return deletes;
}
Program: 167348
Project: 167348
Buggy source:
private TableData findInserts(TableData existingData,TableData newData,String primaryKeyColumns){
  boolean found;
  TableData inserts=new TableData(newData.tableName);
  for (  LinkedCaseInsensitiveMap<Object> newRow : newData.getTableData()) {
    String newPk=getPkDataAsString(newRow,primaryKeyColumns);
    found=false;
    for (    LinkedCaseInsensitiveMap<Object> existingRow : existingData.getTableData()) {
      String existingPk=getPkDataAsString(existingRow,primaryKeyColumns);
      if (newPk.equalsIgnoreCase(existingPk)) {
        found=true;
      }
    }
    if (!found) {
      inserts.getTableData().add(newRow);
    }
  }
  return inserts;
}

Fixed version (ground truth):
private TableData findInserts(TableData existingData,TableData newData,String primaryKeyColumns){
  boolean found;
  TableData inserts=new TableData(newData.tableName);
  Iterator<String> newRowItr=newData.getTableData().keySet().iterator();
  while (newRowItr.hasNext()) {
    String newPk=newRowItr.next();
    LinkedCaseInsensitiveMap<Object> newRow=newData.getTableData().get(newPk);
    found=false;
    Iterator<String> existingRowItr=existingData.getTableData().keySet().iterator();
    while (existingRowItr.hasNext()) {
      String existingPk=existingRowItr.next();
      if (newPk.equalsIgnoreCase(existingPk)) {
        found=true;
      }
      if (!found) {
        inserts.getTableData().put(newPk,newRow);
      }
    }
  }
  return inserts;
}
Program: 167349
Project: 167349
Buggy source:
private void importProjectConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)importData.getProjectData().get(1).getTableData().get(0).get("String_Node_Str");
  List<TableData> existingProjectData=new ArrayList<TableData>();
  initConfigData(existingProjectData,PROJECT_SQL);
  for (  LinkedCaseInsensitiveMap<Object> row : importData.getProjectData().get(0).getTableData()) {
    addConfigData(existingProjectData,PROJECT_SQL,projectVersionId,(String)row.get(PROJECT_SQL[0][2]));
  }
  for (int i=0; i <= PROJECT_SQL.length - 1; i++) {
    TableData importProjectData=importData.projectData.get(i);
    processConfigTableData(importData,existingProjectData.get(i),importProjectData,PROJECT_SQL[i][2],transaction);
  }
}

Fixed version (ground truth):
private void importProjectConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)getOneRow(importData.getProjectData().get(PROJECT_VERSION_IDX)).get("String_Node_Str");
  List<TableData> existingProjectData=new ArrayList<TableData>();
  initConfigData(existingProjectData,PROJECT_SQL);
  Iterator<String> itr=importData.getProjectData().get(PROJECT_IDX).getTableData().keySet().iterator();
  while (itr.hasNext()) {
    String key=itr.next();
    LinkedCaseInsensitiveMap<Object> row=importData.getProjectData().get(PROJECT_IDX).getTableData().get(key);
    addConfigData(existingProjectData,PROJECT_SQL,projectVersionId,(String)row.get(PROJECT_SQL[PROJECT_IDX][KEY_COLUMNS]));
  }
  for (int i=0; i <= PROJECT_SQL.length - 1; i++) {
    TableData importProjectData=importData.projectData.get(i);
    processConfigTableData(importData,existingProjectData.get(i),importProjectData,PROJECT_SQL[i][KEY_COLUMNS],transaction);
  }
}
Program: 167350
Project: 167350
Buggy source:
public void setTableData(List<LinkedCaseInsensitiveMap<Object>> tableData){
  this.rows=tableData;
}

Fixed version (ground truth):
public void setTableData(Map<String,LinkedCaseInsensitiveMap<Object>> tableData){
  this.rows=tableData;
}
Program: 167351
Project: 167351
Buggy source:
private void importFlowConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)importData.getFlowData().get(4).getTableData().get(0).get("String_Node_Str");
  List<TableData> existingFlowData=new ArrayList<TableData>();
  initConfigData(existingFlowData,FLOW_SQL);
  for (  LinkedCaseInsensitiveMap<Object> row : importData.getFlowData().get(4).getTableData()) {
    addConfigData(existingFlowData,FLOW_SQL,projectVersionId,(String)row.get(FLOW_SQL[4][2]));
  }
  for (int i=0; i <= FLOW_SQL.length - 1; i++) {
    TableData importFlowData=importData.flowData.get(i);
    processConfigTableData(importData,existingFlowData.get(i),importFlowData,FLOW_SQL[i][2],transaction);
  }
}

Fixed version (ground truth):
private void importFlowConfiguration(ImportConfigData importData,ISqlTransaction transaction){
  String projectVersionId=(String)getOneRow(importData.getFlowData().get(FLOW_IDX)).get("String_Node_Str");
  List<TableData> existingFlowData=new ArrayList<TableData>();
  initConfigData(existingFlowData,FLOW_SQL);
  Iterator<String> itr=importData.getFlowData().get(FLOW_IDX).getTableData().keySet().iterator();
  while (itr.hasNext()) {
    String key=itr.next();
    LinkedCaseInsensitiveMap<Object> row=importData.getFlowData().get(FLOW_IDX).getTableData().get(key);
    addConfigData(existingFlowData,FLOW_SQL,projectVersionId,(String)row.get(FLOW_SQL[FLOW_IDX][KEY_COLUMNS]));
  }
  for (int i=0; i <= FLOW_SQL.length - 1; i++) {
    TableData importFlowData=importData.flowData.get(i);
    processConfigTableData(importData,existingFlowData.get(i),importFlowData,FLOW_SQL[i][KEY_COLUMNS],transaction);
  }
}
Program: 167352
Project: 167352
Buggy source:
private void addConfigData(List<TableData> tableData,String[][] sqlElements,String projectVersionId,String keyValue){
  for (int i=0; i <= sqlElements.length - 1; i++) {
    String[] entry=sqlElements[i];
    tableData.get(i).rows.addAll(getConfigTableData(String.format(entry[1],tablePrefix,projectVersionId,keyValue)));
  }
}

Fixed version (ground truth):
private void addConfigData(List<TableData> tableData,String[][] sqlElements,String projectVersionId,String keyValue){
  for (int i=0; i <= sqlElements.length - 1; i++) {
    String[] entry=sqlElements[i];
    List<Row> rows=getConfigTableData(String.format(entry[SQL],tablePrefix,projectVersionId,keyValue));
    for (    Row row : rows) {
      tableData.get(i).rows.put(getPkDataAsString(row,entry[KEY_COLUMNS]),row);
    }
  }
}
Program: 167353
Project: 167353
Buggy source:
public List<LinkedCaseInsensitiveMap<Object>> getTableData(){
  return rows;
}

Fixed version (ground truth):
public Map<String,LinkedCaseInsensitiveMap<Object>> getTableData(){
  return rows;
}
Program: 167354
Project: 167354
Buggy source:
private void processTableInserts(TableData inserts,ISqlTransaction transaction){
  Table table=databasePlatform.getTableFromCache(null,null,inserts.getTableName(),false);
  excludeColumns(table);
  DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.INSERT,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),table.getColumns(),null,null,true);
  for (  LinkedCaseInsensitiveMap<Object> row : inserts.getTableData()) {
    transaction.prepareAndExecute(stmt.getSql(),row);
  }
}

Fixed version (ground truth):
private void processTableInserts(TableData inserts,ISqlTransaction transaction){
  try {
    Table table=databasePlatform.getTableFromCache(null,null,inserts.getTableName(),false);
    excludeColumns(table);
    DmlStatement stmt=databasePlatform.createDmlStatement(DmlType.INSERT,table.getCatalog(),table.getSchema(),table.getName(),table.getPrimaryKeyColumns(),table.getColumns(),null,null,true);
    Iterator<String> itr=inserts.getTableData().keySet().iterator();
    while (itr.hasNext()) {
      String key=itr.next();
      LinkedCaseInsensitiveMap<Object> row=inserts.getTableData().get(key);
      transaction.prepareAndExecute(stmt.getSql(),row);
    }
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + e.getMessage());
  }
}
Program: 167355
Project: 167355
Buggy source:
@SuppressWarnings("String_Node_Str") protected <T extends AbstractObject>T copyWithNewUUID(Map<String,String> oldToNewUUIDMapping,T original){
  T copy=(T)original.clone();
  copy.setId(UUID.randomUUID().toString());
  oldToNewUUIDMapping.put(original.getId(),copy.getId());
  return copy;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") protected <T extends AbstractObject>T copyWithNewUUID(Map<String,AbstractObject> oldToNewUUIDMapping,T original){
  T copy=(T)original.clone();
  copy.setId(UUID.randomUUID().toString());
  oldToNewUUIDMapping.put(original.getId(),copy);
  return copy;
}
Program: 167356
Project: 167356
Buggy source:
protected Component copy(Map<String,String> oldToNewUUIDMapping,Component original){
  Component component=copyWithNewUUID(oldToNewUUIDMapping,original);
  component.setEntitySettings(new ArrayList<ComponentEntitySetting>());
  component.setAttributeSettings(new ArrayList<ComponentAttributeSetting>());
  component.setSettings(new ArrayList<Setting>());
  for (  Setting setting : original.getSettings()) {
    ComponentSetting cSetting=(ComponentSetting)copyWithNewUUID(oldToNewUUIDMapping,setting);
    cSetting.setComponentId(component.getId());
    component.getSettings().add(cSetting);
  }
  for (  ComponentAttributeSetting setting : original.getAttributeSettings()) {
    setting=(ComponentAttributeSetting)copyWithNewUUID(oldToNewUUIDMapping,setting);
    setting.setComponentId(component.getId());
    component.getAttributeSettings().add(setting);
  }
  for (  ComponentEntitySetting setting : original.getEntitySettings()) {
    setting=(ComponentEntitySetting)copyWithNewUUID(oldToNewUUIDMapping,setting);
    setting.setComponentId(component.getId());
    component.getEntitySettings().add(setting);
  }
  return component;
}

Fixed version (ground truth):
protected Component copy(Map<String,AbstractObject> oldToNewUUIDMapping,Component original){
  Component component=copyWithNewUUID(oldToNewUUIDMapping,original);
  AbstractObject obj=oldToNewUUIDMapping.get(original.getInputModelId());
  if (obj != null) {
    component.setInputModelId(obj.getId());
  }
  obj=oldToNewUUIDMapping.get(original.getOutputModelId());
  if (obj != null) {
    component.setOutputModelId(obj.getId());
  }
  obj=oldToNewUUIDMapping.get(original.getResourceId());
  if (obj != null) {
    component.setResourceId(obj.getId());
  }
  component.setEntitySettings(new ArrayList<ComponentEntitySetting>());
  component.setAttributeSettings(new ArrayList<ComponentAttributeSetting>());
  component.setSettings(new ArrayList<Setting>());
  for (  Setting setting : original.getSettings()) {
    ComponentSetting cSetting=(ComponentSetting)copyWithNewUUID(oldToNewUUIDMapping,setting);
    cSetting.setComponentId(component.getId());
    component.getSettings().add(cSetting);
  }
  for (  ComponentAttributeSetting setting : original.getAttributeSettings()) {
    setting=(ComponentAttributeSetting)copyWithNewUUID(oldToNewUUIDMapping,setting);
    setting.setComponentId(component.getId());
    component.getAttributeSettings().add(setting);
  }
  for (  ComponentEntitySetting setting : original.getEntitySettings()) {
    setting=(ComponentEntitySetting)copyWithNewUUID(oldToNewUUIDMapping,setting);
    setting.setComponentId(component.getId());
    component.getEntitySettings().add(setting);
  }
  return component;
}
Program: 167357
Project: 167357
Buggy source:
@Override public ProjectVersion saveNewVersion(String newVersionLabel,ProjectVersion original){
  Map<String,String> oldToNewUUIDMapping=new HashMap<>();
  ProjectVersion newVersion=copyWithNewUUID(oldToNewUUIDMapping,original);
  newVersion.setVersionLabel(newVersionLabel);
  newVersion.setCreateTime(new Date());
  newVersion.setOrigVersionId(original.getId());
  save(newVersion);
  List<ModelName> models=findModelsInProject(original.getId());
  for (  ModelName modelName : models) {
    Model newModel=copy(oldToNewUUIDMapping,findModel(modelName.getId()));
    newModel.setProjectVersionId(newVersion.getId());
    save(newModel);
  }
  List<ResourceName> resources=findResourcesInProject(original.getId());
  for (  ResourceName resourceName : resources) {
    Resource newResource=copy(oldToNewUUIDMapping,findResource(resourceName.getId()));
    newResource.setProjectVersionId(newVersion.getId());
    save(newResource);
  }
  List<FlowName> testFlows=findFlowsInProject(original.getId(),true);
  for (  FlowName flowName : testFlows) {
    Flow newFlow=copy(oldToNewUUIDMapping,findFlow(flowName.getId()));
    newFlow.setProjectVersionId(newVersion.getId());
    save(newFlow);
  }
  List<FlowName> flows=findFlowsInProject(original.getId(),false);
  for (  FlowName flowName : flows) {
    Flow newFlow=copy(oldToNewUUIDMapping,findFlow(flowName.getId()));
    newFlow.setProjectVersionId(newVersion.getId());
    save(newFlow);
  }
  return newVersion;
}

Fixed version (ground truth):
@Override public ProjectVersion saveNewVersion(String newVersionLabel,ProjectVersion original){
  Map<String,AbstractObject> oldToNewUUIDMapping=new HashMap<>();
  ProjectVersion newVersion=copyWithNewUUID(oldToNewUUIDMapping,original);
  newVersion.setVersionLabel(newVersionLabel);
  newVersion.setCreateTime(new Date());
  newVersion.setOrigVersionId(original.getId());
  save(newVersion);
  List<ModelName> models=findModelsInProject(original.getId());
  for (  ModelName modelName : models) {
    Model newModel=copy(oldToNewUUIDMapping,findModel(modelName.getId()));
    newModel.setProjectVersionId(newVersion.getId());
    save(newModel);
  }
  List<ResourceName> resources=findResourcesInProject(original.getId());
  for (  ResourceName resourceName : resources) {
    Resource newResource=copy(oldToNewUUIDMapping,findResource(resourceName.getId()));
    newResource.setProjectVersionId(newVersion.getId());
    save(newResource);
  }
  List<FlowName> testFlows=findFlowsInProject(original.getId(),true);
  for (  FlowName flowName : testFlows) {
    Flow newFlow=copy(oldToNewUUIDMapping,findFlow(flowName.getId()),true);
    newFlow.setProjectVersionId(newVersion.getId());
    save(newFlow,true);
  }
  List<FlowName> flows=findFlowsInProject(original.getId(),false);
  for (  FlowName flowName : flows) {
    Flow newFlow=copy(oldToNewUUIDMapping,findFlow(flowName.getId()),true);
    newFlow.setProjectVersionId(newVersion.getId());
    save(newFlow);
  }
  return newVersion;
}
Program: 167358
Project: 167358
Buggy source:
protected void massageValues(Map<String,String> oldToNewUUIDMapping,List<? extends Setting> settings){
  for (  Setting setting : settings) {
    setting.setValue(FormatUtils.replaceTokens(setting.getValue(),oldToNewUUIDMapping,false));
  }
}

Fixed version (ground truth):
protected void massageValues(Map<String,AbstractObject> oldToNewUUIDMapping,List<? extends Setting> settings){
  for (  Setting setting : settings) {
    setting.setValue(FormatUtils.replaceTokens(setting.getValue(),toStringTokens(oldToNewUUIDMapping),false));
  }
}