nus-yam/ex-repair huggingface dataset:
Program: 118397
Project: 118397
Buggy source:
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    String seletetedMetadataTableName=getSeletetedMetadataTableName(table);
    for (    ComponentProperties compPro : componentProperties) {
      if (seletetedMetadataTableName != null) {
        if (!compPro.getName().equals(seletetedMetadataTableName)) {
          continue;
        }
      }
      Property property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property) && paramValue != null) {
          return getRepositoryValueOfStringType(connection,paramValue.toString());
        }
        if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return paramValue.toString();
        }
        return paramValue;
      }
    }
    if (value.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return getGenericRepositoryValue(connection,componentProperties,value.substring(value.indexOf(IGenericConstants.EXP_SEPARATOR) + 1),table);
    }
  }
  return null;
}

Fixed version (ground truth):
private Object getGenericRepositoryValue(GenericConnection connection,List<ComponentProperties> componentProperties,String value,IMetadataTable table){
  if (componentProperties != null && value != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property property=compPro.getValuedProperty(value);
      if (property != null) {
        Object paramValue=property.getStoredValue();
        if (GenericTypeUtils.isStringType(property) && paramValue != null) {
          return getRepositoryValueOfStringType(connection,paramValue.toString());
        }
 else         if (GenericTypeUtils.isEnumType(property) && paramValue != null) {
          return paramValue.toString();
        }
        return paramValue;
      }
    }
    if (value.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return getGenericRepositoryValue(connection,componentProperties,value.substring(value.indexOf(IGenericConstants.EXP_SEPARATOR) + 1),table);
    }
  }
  return null;
}
Program: 118398
Project: 118398
Buggy source:
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
      IGenericWizardService wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
      if (wizardService != null && wizardService.isGenericConnection(connection)) {
        return getGenericRepositoryValue((GenericConnection)connection,wizardService.getAllComponentProperties(connection),value,table);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
      IGenericWizardService wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
      if (wizardService != null && wizardService.isGenericConnection(connection)) {
        return getGenericRepositoryValue((GenericConnection)connection,wizardService.getAllComponentProperties(connection,getSeletetedMetadataTableName(table)),value,table);
      }
    }
  }
  return null;
}
Program: 118401
Project: 118401
Buggy source:
private boolean validateFields(){
  boolean valid=true;
  ConnectionBean connection=getConnection();
  boolean usesMailCheck=brandingService.getBrandingConfiguration().isUseMailLoginCheck();
  boolean serverIsLocal=!isAuthenticationNeeded();
  if (valid && getConnection() == null) {
    valid=false;
  }
 else   if (valid && !getConnection().isComplete()) {
    valid=false;
  }
 else   if (valid && !serverIsLocal && connection.getUser().length() == 0) {
    valid=false;
  }
 else   if (valid && usesMailCheck && !Pattern.matches(RepositoryConstants.MAIL_PATTERN,getUser().getLogin())) {
    valid=false;
  }
  if (valid && !serverIsLocal && connection.getPassword().length() == 0) {
    valid=false;
  }
  return valid;
}

Fixed version (ground truth):
private boolean validateFields(){
  boolean valid=true;
  ConnectionBean connection=getConnection();
  boolean isRemote=LoginHelper.isRemoteConnection(connection);
  boolean serverIsLocal=!isAuthenticationNeeded();
  if (valid && getConnection() == null) {
    valid=false;
  }
 else   if (valid && !getConnection().isComplete()) {
    valid=false;
  }
 else   if (valid && !serverIsLocal && connection.getUser().length() == 0) {
    valid=false;
  }
 else   if (valid && !isRemote && !Pattern.matches(RepositoryConstants.MAIL_PATTERN,getUser().getLogin())) {
    valid=false;
  }
  if (valid && !serverIsLocal && connection.getPassword().length() == 0) {
    valid=false;
  }
  return valid;
}
Program: 118407
Project: 118407
Buggy source:
private String getOriginalColumnName(String entryName,DbMapComponent component,ExternalDbMapTable table){
  List<IConnection> inputConnections=(List<IConnection>)component.getIncomingConnections();
  if (inputConnections != null) {
    for (    IConnection iconn : inputConnections) {
      IMetadataTable metadataTable=iconn.getMetadataTable();
      String tName=iconn.getName();
      String tableValue=table.getTableName();
      if (tableValue != null && tableValue.equals(tName) && metadataTable != null) {
        List<IMetadataColumn> lColumn=metadataTable.getListColumns();
        for (        IMetadataColumn colu : lColumn) {
          if (colu.getLabel().equals(entryName)) {
            entryName=colu.getOriginalDbColumnName();
            return entryName;
          }
        }
      }
    }
  }
  return entryName;
}

Fixed version (ground truth):
private String getOriginalColumnName(String entryName,DbMapComponent component,ExternalDbMapTable table){
  List<IConnection> inputConnections=(List<IConnection>)component.getIncomingConnections();
  if (inputConnections != null) {
    for (    IConnection iconn : inputConnections) {
      IMetadataTable metadataTable=iconn.getMetadataTable();
      String tName=iconn.getName();
      String tableValue=table.getTableName();
      if (tableValue != null && tableValue.equals(tName) && metadataTable != null) {
        List<IMetadataColumn> lColumn=metadataTable.getListColumns();
        for (        IMetadataColumn colu : lColumn) {
          if (colu.getLabel().equals(entryName)) {
            String tempName=colu.getOriginalDbColumnName();
            if (tempName != null && tempName.length() > 0) {
              entryName=tempName;
              return entryName;
            }
          }
        }
      }
    }
  }
  return entryName;
}
Program: 118409
Project: 118409
Buggy source:
@Override public void transform(NodeType node){
  String openBrStr="String_Node_Str";
  String closeBrStr="String_Node_Str";
  String openBrPattern=Pattern.quote(openBrStr);
  String closeBrPattern=Pattern.quote(closeBrStr);
  ProcessType item=(ProcessType)node.eContainer();
  for (  Object o : item.getNode()) {
    NodeType nt=(NodeType)o;
    for (    Object o1 : nt.getElementParameter()) {
      ElementParameterType t=(ElementParameterType)o1;
      if ("String_Node_Str".equals(t.getField()) && tablesToCheck.contains(t.getName())) {
        List<ElementValueType> elementValues=(List<ElementValueType>)t.getElementValue();
        for (int i=0; i < elementValues.size() - 1; i++) {
          ElementValueType nameCol=elementValues.get(i);
          String nameValue=nameCol.getValue();
          if (nameCol.getElementRef().equals("String_Node_Str") && nameValue != null && fieldNames.contains(nameValue)) {
            ElementValueType valueCol=elementValues.get(++i);
            String value=valueCol != null ? valueCol.getValue().trim() : null;
            if (value != null && value.contains(openBrStr) || value.contains(closeBrStr)) {
              String newValue=value.replaceFirst(openBrPattern,"String_Node_Str").replaceFirst(closeBrPattern,"String_Node_Str");
              if (!value.equals(newValue)) {
                valueCol.setValue(newValue);
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void transform(NodeType node){
  String openBrStr="String_Node_Str";
  String closeBrStr="String_Node_Str";
  String openBrPattern=Pattern.quote(openBrStr);
  String closeBrPattern=Pattern.quote(closeBrStr);
  ProcessType item=(ProcessType)node.eContainer();
  for (  Object o : item.getNode()) {
    NodeType nt=(NodeType)o;
    for (    Object o1 : nt.getElementParameter()) {
      ElementParameterType t=(ElementParameterType)o1;
      if ("String_Node_Str".equals(t.getField()) && tableToCheck.equals(t.getName())) {
        List<ElementValueType> elementValues=(List<ElementValueType>)t.getElementValue();
        for (int i=0; i < elementValues.size() - 1; i++) {
          ElementValueType nameCol=elementValues.get(i);
          String nameValue=nameCol.getValue();
          if (nameCol.getElementRef().equals("String_Node_Str") && nameValue != null && fieldNames.contains(nameValue)) {
            ElementValueType valueCol=elementValues.get(++i);
            String value=valueCol != null ? valueCol.getValue().trim() : null;
            if (value != null && value.contains(openBrStr) || value.contains(closeBrStr)) {
              String newValue=value.replaceFirst(openBrPattern,"String_Node_Str").replaceFirst(closeBrPattern,"String_Node_Str");
              if (!value.equals(newValue)) {
                valueCol.setValue(newValue);
              }
            }
          }
        }
      }
    }
  }
}
Program: 118411
Project: 118411
Buggy source:
@Override public boolean containsPoint(int x,int y){
  return this.getBounds().contains(x,y);
}

Fixed version (ground truth):
@Override public boolean containsPoint(int x,int y){
  Rectangle tempBounds=new Rectangle();
  int tolerance=(int)Math.max(getLineWidthFloat() / 2.0f,3 + getLineWidth() / 2);
  tempBounds.setBounds(getBounds());
  tempBounds.expand(tolerance,tolerance);
  if (!tempBounds.contains(x,y))   return false;
  return shapeContainsPoint(x,y) || childrenContainsPoint(x,y);
}
Program: 118412
Project: 118412
Buggy source:
@Override public void setup(ComponentProperties properties){
  properties.setValueEvaluator(new PropertyValueEvaluator(){
    @Override public Object evaluate(    Property property,    Object storedValue){
      Property newProperty=(Property)newProperties.getProperty(property.getName());
      if (newProperty == null) {
        if ("String_Node_Str".equals(property.getName())) {
          newProperty=(Property)newProperties.getValuedProperty("String_Node_Str");
        }
 else {
          return null;
        }
      }
      if (storedValue instanceof String) {
        if (GenericTypeUtils.isEnumType(newProperty)) {
          if (newProperty != null) {
            List<?> propertyPossibleValues=((Property<?>)newProperty).getPossibleValues();
            if (propertyPossibleValues != null) {
              for (              Object possibleValue : propertyPossibleValues) {
                if (possibleValue.toString().equals(storedValue)) {
                  property.setStoredValue(possibleValue);
                  return possibleValue;
                }
              }
            }
          }
        }
      }
      if (GenericTypeUtils.isBooleanType(newProperty)) {
        return false;
      }
      return storedValue;
    }
  }
);
}

Fixed version (ground truth):
@Override public void setup(ComponentProperties properties){
  properties.setValueEvaluator(new PropertyValueEvaluator(){
    @Override public Object evaluate(    Property property,    Object storedValue){
      Property newProperty=(Property)newProperties.getProperty(property.getName());
      if (newProperty == null) {
        newProperty=newProperties.getValuedProperty("String_Node_Str" + property.getName());
        if (newProperty == null) {
          if ("String_Node_Str".equals(property.getName())) {
            return false;
          }
          return null;
        }
      }
      if (storedValue instanceof String) {
        if (GenericTypeUtils.isEnumType(newProperty)) {
          if (newProperty != null) {
            List<?> propertyPossibleValues=((Property<?>)newProperty).getPossibleValues();
            if (propertyPossibleValues != null) {
              for (              Object possibleValue : propertyPossibleValues) {
                if (possibleValue.toString().equals(storedValue)) {
                  property.setStoredValue(possibleValue);
                  return possibleValue;
                }
              }
            }
          }
        }
      }
      if (GenericTypeUtils.isBooleanType(newProperty)) {
        return false;
      }
      return storedValue;
    }
  }
);
}
Program: 118415
Project: 118415
Buggy source:
@Override public Object evaluate(Property property,Object storedValue){
  Property newProperty=(Property)newProperties.getProperty(property.getName());
  if (newProperty == null) {
    if ("String_Node_Str".equals(property.getName())) {
      newProperty=(Property)newProperties.getValuedProperty("String_Node_Str");
    }
 else {
      return null;
    }
  }
  if (storedValue instanceof String) {
    if (GenericTypeUtils.isEnumType(newProperty)) {
      if (newProperty != null) {
        List<?> propertyPossibleValues=((Property<?>)newProperty).getPossibleValues();
        if (propertyPossibleValues != null) {
          for (          Object possibleValue : propertyPossibleValues) {
            if (possibleValue.toString().equals(storedValue)) {
              property.setStoredValue(possibleValue);
              return possibleValue;
            }
          }
        }
      }
    }
  }
  if (GenericTypeUtils.isBooleanType(newProperty)) {
    return false;
  }
  return storedValue;
}

Fixed version (ground truth):
@Override public Object evaluate(Property property,Object storedValue){
  Property newProperty=(Property)newProperties.getProperty(property.getName());
  if (newProperty == null) {
    newProperty=newProperties.getValuedProperty("String_Node_Str" + property.getName());
    if (newProperty == null) {
      if ("String_Node_Str".equals(property.getName())) {
        return false;
      }
      return null;
    }
  }
  if (storedValue instanceof String) {
    if (GenericTypeUtils.isEnumType(newProperty)) {
      if (newProperty != null) {
        List<?> propertyPossibleValues=((Property<?>)newProperty).getPossibleValues();
        if (propertyPossibleValues != null) {
          for (          Object possibleValue : propertyPossibleValues) {
            if (possibleValue.toString().equals(storedValue)) {
              property.setStoredValue(possibleValue);
              return possibleValue;
            }
          }
        }
      }
    }
  }
  if (GenericTypeUtils.isBooleanType(newProperty)) {
    return false;
  }
  return storedValue;
}
Program: 118417
Project: 118417
Buggy source:
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  File tmpJob=null;
  try {
    tmpJob=File.createTempFile("String_Node_Str","String_Node_Str",null);
    exportChoiceMap.put(ExportChoice.binaries,true);
    exportChoiceMap.put(ExportChoice.includeLibs,true);
    ProcessItem processItem=(ProcessItem)node.getObject().getProperty().getItem();
    BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(),processItem,processItem.getProperty().getVersion(),processItem.getProcess().getDefaultContext(),exportChoiceMap,exportType,monitor);
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    FeaturesModel featuresModel=getFeatureModel(tmpJob);
    process(processItem,featuresModel,monitor);
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InvocationTargetException(e);
  }
 finally {
    if (tmpJob != null && tmpJob.exists()) {
      tmpJob.delete();
    }
  }
}

Fixed version (ground truth):
private void exportJobForPOJO(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
  File tmpJob=null;
  try {
    tmpJob=File.createTempFile("String_Node_Str","String_Node_Str",null);
    exportChoiceMap.put(ExportChoice.binaries,true);
    exportChoiceMap.put(ExportChoice.includeLibs,true);
    ProcessItem processItem=(ProcessItem)node.getObject().getProperty().getItem();
    BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(),processItem,processItem.getProperty().getVersion(),processItem.getProcess().getDefaultContext(),exportChoiceMap,exportType,true,monitor);
    monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
    FeaturesModel featuresModel=getFeatureModel(tmpJob);
    process(processItem,featuresModel,monitor);
  }
 catch (  InterruptedException e) {
    throw e;
  }
catch (  Exception e) {
    throw new InvocationTargetException(e);
  }
 finally {
    if (tmpJob != null && tmpJob.exists()) {
      tmpJob.delete();
    }
  }
}
Program: 118423
Project: 118423
Buggy source:
/** 
 * Save the outline picture for this editor.
 * @param viewer
 */
protected void saveOutlinePicture(ScrollingGraphicalViewer viewer){
  GlobalConstant.generatingScreenShoot=true;
  LayerManager layerManager=(LayerManager)viewer.getEditPartRegistry().get(LayerManager.ID);
  IFigure backgroundLayer=layerManager.getLayer(LayerConstants.GRID_LAYER);
  IFigure contentLayer=layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
  FreeformViewport viewport=(FreeformViewport)((TalendScalableFreeformRootEditPart)layerManager).getFigure();
  int width=contentLayer.getBounds().width;
  int height=contentLayer.getBounds().height;
  Image img=new Image(null,width,height);
  GC gc=new GC(img);
  Graphics graphics=new SWTGraphics(gc);
  graphics.translate(-1 * contentLayer.getBounds().x + viewport.getViewLocation().x,-1 * contentLayer.getBounds().y + viewport.getViewLocation().y);
  Point point=contentLayer.getBounds().getTopLeft();
  IProcess2 process=getProcess();
  process.setPropertyValue(IProcess.SCREEN_OFFSET_X,String.valueOf(-point.x));
  process.setPropertyValue(IProcess.SCREEN_OFFSET_Y,String.valueOf(-point.y));
  backgroundLayer.paint(graphics);
  contentLayer.paint(graphics);
  graphics.dispose();
  gc.dispose();
  process.getScreenshots().put("String_Node_Str",ImageUtils.saveImageToData(img));
  img.dispose();
  GlobalConstant.generatingScreenShoot=false;
}

Fixed version (ground truth):
/** 
 * Save the outline picture for this editor.
 * @param viewer
 */
protected void saveOutlinePicture(ScrollingGraphicalViewer viewer){
  GlobalConstant.generatingScreenShoot=true;
  LayerManager layerManager=(LayerManager)viewer.getEditPartRegistry().get(LayerManager.ID);
  IFigure backgroundLayer=layerManager.getLayer(LayerConstants.GRID_LAYER);
  IFigure contentLayer=layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
  FreeformViewport viewport=(FreeformViewport)((TalendScalableFreeformRootEditPart)layerManager).getFigure();
  viewport.getUpdateManager().performUpdate();
  int width=contentLayer.getBounds().width;
  int height=contentLayer.getBounds().height;
  Image img=new Image(null,width,height);
  GC gc=new GC(img);
  Graphics graphics=new SWTGraphics(gc);
  graphics.translate(-1 * contentLayer.getBounds().x + viewport.getViewLocation().x,-1 * contentLayer.getBounds().y + viewport.getViewLocation().y);
  Point point=contentLayer.getBounds().getTopLeft();
  IProcess2 process=getProcess();
  process.setPropertyValue(IProcess.SCREEN_OFFSET_X,String.valueOf(-point.x));
  process.setPropertyValue(IProcess.SCREEN_OFFSET_Y,String.valueOf(-point.y));
  backgroundLayer.paint(graphics);
  contentLayer.paint(graphics);
  graphics.dispose();
  gc.dispose();
  process.getScreenshots().put("String_Node_Str",ImageUtils.saveImageToData(img));
  img.dispose();
  GlobalConstant.generatingScreenShoot=false;
}
Program: 118424
Project: 118424
Buggy source:
private void createOrUpdateConnectionItem() throws CoreException {
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  IWorkspaceRunnable operation=new IWorkspaceRunnable(){
    @Override public void run(    IProgressMonitor monitor) throws CoreException {
      try {
        Form form=wizPage.getForm();
        if (form.isCallAfterFormFinish()) {
          if (creation) {
            factory.create(connectionItem,new Path("String_Node_Str"));
          }
          compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
        }
        if (!creation) {
          GenericUpdateManager.updateGenericConnection(connectionItem,oldMetadataTable);
        }
        updateConnectionItem(factory);
      }
 catch (      Throwable e) {
        throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
      }
    }
  }
;
  ISchedulingRule schedulingRule=workspace.getRoot();
  workspace.run(operation,schedulingRule,IWorkspace.AVOID_UPDATE,new NullProgressMonitor());
}

Fixed version (ground truth):
private void createOrUpdateConnectionItem() throws CoreException {
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  IWorkspaceRunnable operation=new IWorkspaceRunnable(){
    @Override public void run(    IProgressMonitor monitor) throws CoreException {
      try {
        Form form=wizPage.getForm();
        if (form.isCallAfterFormFinish()) {
          if (creation) {
            factory.create(connectionItem,pathToSave);
          }
          compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
        }
        if (!creation) {
          GenericUpdateManager.updateGenericConnection(connectionItem,oldMetadataTable);
        }
        updateConnectionItem(factory);
      }
 catch (      Throwable e) {
        throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
      }
    }
  }
;
  ISchedulingRule schedulingRule=workspace.getRoot();
  workspace.run(operation,schedulingRule,IWorkspace.AVOID_UPDATE,new NullProgressMonitor());
}
Program: 118425
Project: 118425
Buggy source:
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    Form form=wizPage.getForm();
    if (form.isCallAfterFormFinish()) {
      if (creation) {
        factory.create(connectionItem,new Path("String_Node_Str"));
      }
      compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
    }
    if (!creation) {
      GenericUpdateManager.updateGenericConnection(connectionItem,oldMetadataTable);
    }
    updateConnectionItem(factory);
  }
 catch (  Throwable e) {
    throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
  }
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    Form form=wizPage.getForm();
    if (form.isCallAfterFormFinish()) {
      if (creation) {
        factory.create(connectionItem,pathToSave);
      }
      compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
    }
    if (!creation) {
      GenericUpdateManager.updateGenericConnection(connectionItem,oldMetadataTable);
    }
    updateConnectionItem(factory);
  }
 catch (  Throwable e) {
    throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
  }
}
Program: 118427
Project: 118427
Buggy source:
public void cleanWorkingDirectory(){
  if (archiveFile != null && archiveFile.exists() && archiveFile.isFile()) {
    archiveFile.delete();
  }
}

Fixed version (ground truth):
public void cleanWorkingDirectory(){
  File tmpExportFolder=getTmpExportFolder();
  if (tmpExportFolder != null) {
    org.talend.utils.io.FilesUtils.deleteFolder(tmpExportFolder,true);
  }
}
Program: 118429
Project: 118429
Buggy source:
@Override public void transform(NodeType node){
  String openBrStr="String_Node_Str";
  String closeBrStr="String_Node_Str";
  String openBrPattern=Pattern.quote(openBrStr);
  String closeBrPattern=Pattern.quote(closeBrStr);
  ProcessType item=(ProcessType)node.eContainer();
  for (  Object o : item.getNode()) {
    NodeType nt=(NodeType)o;
    for (    Object o1 : nt.getElementParameter()) {
      ElementParameterType t=(ElementParameterType)o1;
      if ("String_Node_Str".equals(t.getField()) && tablesToCheck.contains(t.getName())) {
        List<ElementValueType> elementValues=(List<ElementValueType>)t.getElementValue();
        for (int i=0; i < elementValues.size() - 1; i++) {
          ElementValueType nameCol=elementValues.get(i);
          String nameValue=nameCol.getValue();
          if (nameCol.getElementRef().equals("String_Node_Str") && nameValue != null && fieldNames.contains(nameValue)) {
            ElementValueType valueCol=elementValues.get(++i);
            String value=valueCol != null ? valueCol.getValue().trim() : null;
            if (value != null && value.contains(openBrStr) || value.contains(closeBrStr)) {
              String newValue=value.replaceFirst(openBrPattern,"String_Node_Str").replaceFirst(closeBrPattern,"String_Node_Str");
              if (!value.equals(newValue)) {
                valueCol.setValue(newValue);
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void transform(NodeType node){
  String openBrStr="String_Node_Str";
  String closeBrStr="String_Node_Str";
  String openBrPattern=Pattern.quote(openBrStr);
  String closeBrPattern=Pattern.quote(closeBrStr);
  ProcessType item=(ProcessType)node.eContainer();
  for (  Object o : item.getNode()) {
    NodeType nt=(NodeType)o;
    for (    Object o1 : nt.getElementParameter()) {
      ElementParameterType t=(ElementParameterType)o1;
      if ("String_Node_Str".equals(t.getField()) && tableToCheck.equals(t.getName())) {
        List<ElementValueType> elementValues=(List<ElementValueType>)t.getElementValue();
        for (int i=0; i < elementValues.size() - 1; i++) {
          ElementValueType nameCol=elementValues.get(i);
          String nameValue=nameCol.getValue();
          if (nameCol.getElementRef().equals("String_Node_Str") && nameValue != null && fieldNames.contains(nameValue)) {
            ElementValueType valueCol=elementValues.get(++i);
            String value=valueCol != null ? valueCol.getValue().trim() : null;
            if (value != null && value.contains(openBrStr) || value.contains(closeBrStr)) {
              String newValue=value.replaceFirst(openBrPattern,"String_Node_Str").replaceFirst(closeBrPattern,"String_Node_Str");
              if (!value.equals(newValue)) {
                valueCol.setValue(newValue);
              }
            }
          }
        }
      }
    }
  }
}
Program: 118434
Project: 118434
Buggy source:
public Command createCommand(Button button){
  List<NamedThing> nals=new ArrayList<>();
  if (curParameter instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)curParameter;
    if (gParam != null) {
      callBeforeActive(gParam);
      List<?> possibleValues=gParam.getPossibleValues();
      if (possibleValues != null) {
        for (        Object object : possibleValues) {
          if (object instanceof NamedThing) {
            nals.add((NamedThing)object);
          }
        }
      }
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),nals);
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=StringUtils.trimToEmpty(nameAndLabelsDialog.getResult());
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        curParameter.setValue(result);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Command createCommand(Button button){
  if (curParameter instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)curParameter;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam));
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=StringUtils.trimToEmpty(nameAndLabelsDialog.getResult());
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        curParameter.setValue(result);
      }
    }
  }
  return null;
}
Program: 118438
Project: 118438
Buggy source:
private void createOrUpdateConnectionItem() throws CoreException {
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  IWorkspaceRunnable operation=new IWorkspaceRunnable(){
    @Override public void run(    IProgressMonitor monitor) throws CoreException {
      try {
        Form form=wizPage.getForm();
        if (form.isCallAfterFormFinish()) {
          if (creation) {
            factory.create(connectionItem,new Path("String_Node_Str"));
          }
          compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
        }
        if (!creation) {
          GenericUpdateManager.updateGenericConnection(connectionItem);
        }
        updateConnectionItem(factory);
      }
 catch (      Throwable e) {
        throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
      }
    }
  }
;
  ISchedulingRule schedulingRule=workspace.getRoot();
  workspace.run(operation,schedulingRule,IWorkspace.AVOID_UPDATE,new NullProgressMonitor());
}

Fixed version (ground truth):
private void createOrUpdateConnectionItem() throws CoreException {
  IWorkspace workspace=ResourcesPlugin.getWorkspace();
  final IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  IWorkspaceRunnable operation=new IWorkspaceRunnable(){
    @Override public void run(    IProgressMonitor monitor) throws CoreException {
      try {
        Form form=wizPage.getForm();
        if (form.isCallAfterFormFinish()) {
          if (creation) {
            factory.create(connectionItem,new Path("String_Node_Str"));
          }
          compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
        }
        if (!creation) {
          GenericUpdateManager.updateGenericConnection(connectionItem,oldMetadataTable);
        }
        updateConnectionItem(factory);
      }
 catch (      Throwable e) {
        throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
      }
    }
  }
;
  ISchedulingRule schedulingRule=workspace.getRoot();
  workspace.run(operation,schedulingRule,IWorkspace.AVOID_UPDATE,new NullProgressMonitor());
}
Program: 118439
Project: 118439
Buggy source:
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    Form form=wizPage.getForm();
    if (form.isCallAfterFormFinish()) {
      if (creation) {
        factory.create(connectionItem,new Path("String_Node_Str"));
      }
      compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
    }
    if (!creation) {
      GenericUpdateManager.updateGenericConnection(connectionItem);
    }
    updateConnectionItem(factory);
  }
 catch (  Throwable e) {
    throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
  }
}

Fixed version (ground truth):
@Override public void run(IProgressMonitor monitor) throws CoreException {
  try {
    Form form=wizPage.getForm();
    if (form.isCallAfterFormFinish()) {
      if (creation) {
        factory.create(connectionItem,new Path("String_Node_Str"));
      }
      compService.afterFormFinish(form.getName(),(ComponentProperties)form.getProperties());
    }
    if (!creation) {
      GenericUpdateManager.updateGenericConnection(connectionItem,oldMetadataTable);
    }
    updateConnectionItem(factory);
  }
 catch (  Throwable e) {
    throw new CoreException(new Status(IStatus.ERROR,IGenericConstants.REPOSITORY_PLUGIN_ID,"String_Node_Str",e));
  }
}
Program: 118441
Project: 118441
Buggy source:
public static boolean updateGenericConnection(ConnectionItem connectionItem,boolean show,final boolean onlySimpleShow){
  List<Relation> relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(),RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.PROPERTY_RELATION);
  RepositoryUpdateManager repositoryUpdateManager=new GenericUpdateManager(connectionItem,relations);
  return repositoryUpdateManager.doWork(true,false);
}

Fixed version (ground truth):
public static boolean updateGenericConnection(ConnectionItem connectionItem,List<IMetadataTable> oldMetadataTable,boolean show,final boolean onlySimpleShow){
  List<Relation> relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(),RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.PROPERTY_RELATION);
  RepositoryUpdateManager repositoryUpdateManager=new GenericUpdateManager(connectionItem,oldMetadataTable,relations);
  return repositoryUpdateManager.doWork(true,false);
}
Program: 118442
Project: 118442
Buggy source:
public GenericUpdateManager(Object parameter,List<Relation> relations){
  super(parameter,relations);
}

Fixed version (ground truth):
public GenericUpdateManager(ConnectionItem connectionItem,List<IMetadataTable> oldMetadataTable,List<Relation> relations){
  super(connectionItem,relations);
  this.connectionItem=connectionItem;
  this.oldMetadataTable=oldMetadataTable;
}
Program: 118444
Project: 118444
Buggy source:
@Override public void run(final IProgressMonitor monitor) throws CoreException {
  if (!alreadyEditedByUser) {
    getProperty().setVersion(mainPage.getNewVersion());
    refreshNewJob();
    try {
      ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    }
 catch (    Exception e) {
      ExceptionHandler.process(e);
    }
  }
  try {
    Item newCreated=null;
    if (processObject.getProperty() != null && processObject.getProperty().getItem() != null) {
      newCreated=processObject.getProperty().getItem();
    }
    if (!(newCreated instanceof BusinessProcessItem)) {
      ProxyRepositoryFactory.getInstance().lock(processObject);
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
catch (  LoginException e) {
    ExceptionHandler.process(e);
  }
  boolean locked=processObject.getRepositoryStatus().equals(ERepositoryStatus.LOCK_BY_USER);
  openAnotherVersion((RepositoryNode)processObject.getRepositoryNode(),!locked);
  try {
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
@Override public void run(final IProgressMonitor monitor) throws CoreException {
  if (!alreadyEditedByUser) {
    refreshNewJob();
    try {
      ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    }
 catch (    Exception e) {
      ExceptionHandler.process(e);
    }
  }
  try {
    Item newCreated=null;
    if (processObject.getProperty() != null && processObject.getProperty().getItem() != null) {
      newCreated=processObject.getProperty().getItem();
    }
    if (!(newCreated instanceof BusinessProcessItem)) {
      ProxyRepositoryFactory.getInstance().lock(processObject);
    }
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
catch (  LoginException e) {
    ExceptionHandler.process(e);
  }
  boolean locked=processObject.getRepositoryStatus().equals(ERepositoryStatus.LOCK_BY_USER);
  openAnotherVersion((RepositoryNode)processObject.getRepositoryNode(),!locked);
  try {
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 118445
Project: 118445
Buggy source:
protected boolean refreshNewJob(){
  if (alreadyEditedByUser) {
    return false;
  }
  StructuredSelection selection=(StructuredSelection)mainPage.getSelection();
  if (selection != null && !selection.isEmpty()) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    boolean lastVersion=node.getObject().getVersion().equals(originalVersion);
    if (!lastVersion) {
      originalVersion=node.getObject().getVersion();
      String newVersion=processObject.getVersion();
      processObject=node.getObject();
      processObject.getProperty().setVersion(newVersion);
    }
  }
  IProxyRepositoryFactory repositoryFactory=CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
  try {
    repositoryFactory.save(getProperty(),this.originaleObjectLabel,this.originalVersion);
    ExpressionPersistance.getInstance().jobNameChanged(originaleObjectLabel,processObject.getLabel());
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    return true;
  }
 catch (  PersistenceException e) {
    MessageBoxExceptionHandler.process(e);
    return false;
  }
}

Fixed version (ground truth):
protected boolean refreshNewJob(){
  if (alreadyEditedByUser) {
    return false;
  }
  boolean lastVersion=true;
  StructuredSelection selection=(StructuredSelection)mainPage.getSelection();
  if (selection != null && !selection.isEmpty()) {
    RepositoryNode node=(RepositoryNode)selection.getFirstElement();
    lastVersion=node.getObject().getVersion().equals(originalVersion);
    if (!lastVersion) {
      originalVersion=node.getObject().getVersion();
      String newVersion=mainPage.getNewVersion();
      processObject=node.getObject();
      processObject.getProperty().setVersion(newVersion);
    }
  }
  if (lastVersion) {
    getProperty().setVersion(mainPage.getNewVersion());
  }
  IProxyRepositoryFactory repositoryFactory=CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
  try {
    repositoryFactory.save(getProperty(),this.originaleObjectLabel,this.originalVersion);
    ExpressionPersistance.getInstance().jobNameChanged(originaleObjectLabel,processObject.getLabel());
    ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
    return true;
  }
 catch (  PersistenceException e) {
    MessageBoxExceptionHandler.process(e);
    return false;
  }
}
Program: 118447
Project: 118447
Buggy source:
public Command createCommand(Button button){
  List<NamedThing> nals=new ArrayList<>();
  if (curParameter instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)curParameter;
    if (gParam != null) {
      callBeforeActive(gParam);
      List<?> possibleValues=gParam.getPossibleValues();
      if (possibleValues != null) {
        for (        Object object : possibleValues) {
          if (object instanceof NamedThing) {
            nals.add((NamedThing)object);
          }
        }
      }
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),nals);
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=StringUtils.trimToEmpty(nameAndLabelsDialog.getResult());
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        curParameter.setValue(result);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public Command createCommand(Button button){
  if (curParameter instanceof GenericElementParameter) {
    GenericElementParameter gParam=(GenericElementParameter)curParameter;
    if (gParam != null) {
      callBeforeActive(gParam);
      NameAndLabelsDialog nameAndLabelsDialog=new NameAndLabelsDialog(composite.getShell(),ComponentsUtils.getFormalPossibleValues(gParam));
      if (nameAndLabelsDialog.open() == IDialogConstants.OK_ID) {
        String propertyName=(String)button.getData(PARAMETER_NAME);
        String result=StringUtils.trimToEmpty(nameAndLabelsDialog.getResult());
        Text moduleText=(Text)hashCurControls.get(propertyName);
        moduleText.setText(result);
        curParameter.setValue(result);
      }
    }
  }
  return null;
}
Program: 118451
Project: 118451
Buggy source:
@Override protected List<String> getSelectedElementLabels(){
  Object value=param.getValue();
  if (value instanceof List) {
    return (List)value;
  }
  return null;
}

Fixed version (ground truth):
@Override protected List<String> getSelectedElementLabels(){
  List<String> labels=new ArrayList<>();
  Object value=param.getValue();
  if (value instanceof List) {
    List<?> values=(List<?>)value;
    for (    Object valueObj : values) {
      if (valueObj instanceof NamedThing) {
        labels.add(((NamedThing)valueObj).getName());
      }
    }
    return labels;
  }
  return null;
}
Program: 118454
Project: 118454
Buggy source:
private void addPropertyParameters(final List<ElementParameter> listParam,final INode node,String formName,EComponentCategory category){
  ComponentProperties props=node.getComponentProperties();
  Form form=props.getForm(formName);
  List<ElementParameter> parameters=ComponentsUtils.getParametersFromForm(node,category,props,form);
  props.setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
  ComponentService componentService=ComponentsUtils.getComponentService();
  for (  ElementParameter parameter : parameters) {
    if (parameter instanceof GenericElementParameter) {
      GenericElementParameter genericElementParameter=(GenericElementParameter)parameter;
      genericElementParameter.setComponentService(componentService);
    }
  }
  listParam.addAll(parameters);
}

Fixed version (ground truth):
private void addPropertyParameters(final List<ElementParameter> listParam,final INode node,String formName,EComponentCategory category){
  ComponentProperties props=node.getComponentProperties();
  Form form=props.getForm(formName);
  List<ElementParameter> parameters=ComponentsUtils.getParametersFromForm(node,this.isInitializing(),category,props,form);
  props.setValueEvaluator(new ComponentContextPropertyValueEvaluator(node));
  ComponentService componentService=ComponentsUtils.getComponentService();
  for (  ElementParameter parameter : parameters) {
    if (parameter instanceof GenericElementParameter) {
      GenericElementParameter genericElementParameter=(GenericElementParameter)parameter;
      genericElementParameter.setComponentService(componentService);
    }
  }
  listParam.addAll(parameters);
}
Program: 118455
Project: 118455
Buggy source:
/** 
 * DOC ycbai Comment method "getRelatedParameters". <p> Get all element parameters related to the <code>parameter<code>. For example the paramters from the form associated with PresentationItem type.
 * @param parameters
 * @return
 */
public static List<ElementParameter> getRelatedParameters(GenericElementParameter parameter){
  List<ElementParameter> params=new ArrayList<>();
  if (parameter == null) {
    return params;
  }
  Widget widget=parameter.getWidget();
  NamedThing content=widget.getContent();
  if (content instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)content;
    Form formtoShow=pi.getFormtoShow();
    List<ElementParameter> parametersFromForm=getParametersFromForm(parameter.getElement(),parameter.getCategory(),parameter.getRootProperties(),formtoShow);
    params.addAll(parametersFromForm);
  }
  return params;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getRelatedParameters". <p> Get all element parameters related to the <code>parameter<code>. For example the paramters from the form associated with PresentationItem type.
 * @param parameters
 * @return
 */
public static List<ElementParameter> getRelatedParameters(GenericElementParameter parameter){
  List<ElementParameter> params=new ArrayList<>();
  if (parameter == null) {
    return params;
  }
  Widget widget=parameter.getWidget();
  NamedThing content=widget.getContent();
  if (content instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)content;
    Form formtoShow=pi.getFormtoShow();
    List<ElementParameter> parametersFromForm=getParametersFromForm(parameter.getElement(),false,parameter.getCategory(),parameter.getRootProperties(),formtoShow);
    params.addAll(parametersFromForm);
  }
  return params;
}
Program: 118457
Project: 118457
Buggy source:
public static Object getParameterValue(IElement element,Property property,EParameterFieldType fieldType){
  Object paramValue=property.getStoredValue();
  if (paramValue instanceof List) {
    return null;
  }
  if (fieldType == EParameterFieldType.CLOSED_LIST) {
    if (paramValue == null) {
      List<?> possibleValues=property.getPossibleValues();
      if (possibleValues != null && possibleValues.size() > 0) {
        paramValue=possibleValues.get(0);
        property.setValue(paramValue);
      }
    }
  }
 else   if (GenericTypeUtils.isStringType(property)) {
    if (!(element instanceof FakeElement || ContextParameterUtils.isContainContextParam((String)paramValue))) {
      paramValue=TalendQuoteUtils.addQuotesIfNotExist((String)paramValue);
    }
  }
 else   if (GenericTypeUtils.isBooleanType(property)) {
    if (paramValue == null) {
      paramValue=Boolean.FALSE;
      property.setValue(paramValue);
    }
  }
  return paramValue;
}

Fixed version (ground truth):
public static Object getParameterValue(IElement element,Property property,EParameterFieldType fieldType,boolean isInitializing){
  Object paramValue=property.getStoredValue();
  if (paramValue instanceof List) {
    return null;
  }
  if (fieldType == EParameterFieldType.CLOSED_LIST) {
    if (paramValue == null) {
      List<?> possibleValues=property.getPossibleValues();
      if (possibleValues != null && possibleValues.size() > 0) {
        paramValue=possibleValues.get(0);
        property.setValue(paramValue);
      }
    }
  }
 else   if (GenericTypeUtils.isStringType(property)) {
    String value=(String)paramValue;
    if ((isInitializing || StringUtils.isEmpty(value)) && !(element instanceof FakeElement || ContextParameterUtils.isContainContextParam(value))) {
      paramValue=TalendQuoteUtils.addPairQuotesIfNotExist(StringUtils.trimToEmpty(value));
    }
  }
 else   if (GenericTypeUtils.isBooleanType(property)) {
    if (paramValue == null) {
      paramValue=Boolean.FALSE;
      property.setValue(paramValue);
    }
  }
  return paramValue;
}