nus-yam/ex-repair huggingface dataset:
Program: 118641
Project: 118641
Buggy source:
public static void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable){
  Schema schema=convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
  componentProperties.setValue(schemaPropertyName,schema);
  Map<String,String> additionalProperties=metadataTable.getAdditionalProperties();
  additionalProperties.put(IComponentConstants.COMPONENT_PROPERTIES_TAG,componentProperties.toSerialized());
  additionalProperties.put(IComponentConstants.COMPONENT_SCHEMA_TAG,schemaPropertyName);
}

Fixed version (ground truth):
public static void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable){
  if (componentProperties == null || schemaPropertyName == null || metadataTable == null) {
    return;
  }
  Schema schema=convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
  componentProperties.setValue(schemaPropertyName,schema);
  Map<String,String> additionalProperties=metadataTable.getAdditionalProperties();
  additionalProperties.put(IComponentConstants.COMPONENT_PROPERTIES_TAG,componentProperties.toSerialized());
  additionalProperties.put(IComponentConstants.COMPONENT_SCHEMA_TAG,schemaPropertyName);
}
Program: 118648
Project: 118648
Buggy source:
private void setSAPSpecailValueForCommand(RepositoryNode selectedNode,ChangeValuesFromRepository command){
  IRepositoryViewObject object=selectedNode.getObject();
  SAPFunctionUnit unit=null;
  if (object != null) {
    if (object instanceof MetadataTableRepositoryObject) {
      MetadataTableRepositoryObject tableObject=(MetadataTableRepositoryObject)object;
      MetadataTable abstractMetadataObject=(MetadataTable)tableObject.getAbstractMetadataObject();
      if (abstractMetadataObject != null && abstractMetadataObject.eContainer() instanceof SAPFunctionUnit) {
        unit=(SAPFunctionUnit)abstractMetadataObject.eContainer();
        command.setSapFunctionLabel(unit.getLabel());
        String currentTableName=unit.getLabel() + "String_Node_Str" + abstractMetadataObject.getTableType()+ "String_Node_Str"+ abstractMetadataObject.getLabel();
        command.setCurrentTableName(currentTableName);
      }
    }
 else     if (object instanceof SAPFunctionRepositoryObject) {
      SAPFunctionRepositoryObject sapObj=(SAPFunctionRepositoryObject)object;
      unit=sapObj.getModelElement();
      command.setSapFunctionLabel(unit.getLabel());
    }
 else     if (object instanceof SAPIDocRepositoryObject) {
      SAPIDocRepositoryObject sapObj=(SAPIDocRepositoryObject)object;
      command.setSapIDocLabel(sapObj.getLabel());
    }
  }
}

Fixed version (ground truth):
private void setSAPSpecailValueForCommand(RepositoryNode selectedNode,ChangeValuesFromRepository command){
  IRepositoryViewObject object=selectedNode.getObject();
  if (object instanceof MetadataColumnRepositoryObject) {
    object=selectedNode.getParent().getParent().getObject();
  }
  SAPFunctionUnit unit=null;
  if (object != null) {
    if (object instanceof MetadataTableRepositoryObject) {
      MetadataTableRepositoryObject tableObject=(MetadataTableRepositoryObject)object;
      MetadataTable abstractMetadataObject=(MetadataTable)tableObject.getAbstractMetadataObject();
      if (abstractMetadataObject != null && abstractMetadataObject.eContainer() instanceof SAPFunctionUnit) {
        unit=(SAPFunctionUnit)abstractMetadataObject.eContainer();
        command.setSapFunctionLabel(unit.getLabel());
        String currentTableName=unit.getLabel() + "String_Node_Str" + abstractMetadataObject.getTableType()+ "String_Node_Str"+ abstractMetadataObject.getLabel();
        command.setCurrentTableName(currentTableName);
      }
 else       if (abstractMetadataObject instanceof SAPTable) {
        command.setCurrentTableName(abstractMetadataObject.getLabel());
      }
    }
 else     if (object instanceof SAPFunctionRepositoryObject) {
      SAPFunctionRepositoryObject sapObj=(SAPFunctionRepositoryObject)object;
      unit=sapObj.getModelElement();
      command.setSapFunctionLabel(unit.getLabel());
    }
 else     if (object instanceof SAPIDocRepositoryObject) {
      SAPIDocRepositoryObject sapObj=(SAPIDocRepositoryObject)object;
      command.setSapIDocLabel(sapObj.getLabel());
    }
  }
}
Program: 118650
Project: 118650
Buggy source:
/** 
 * ftang Comment method "addDocTypeAttribute".
 * @param projectElement
 */
protected String getDocTypeAttribute(){
  return ERepositoryObjectType.JOB_DOC.toString();
}

Fixed version (ground truth):
/** 
 * ftang Comment method "addDocTypeAttribute".
 * @param projectElement
 */
protected String getDocTypeAttribute(){
  if (ERepositoryObjectType.JOB_DOC == null) {
    return "String_Node_Str";
  }
  return ERepositoryObjectType.JOB_DOC.toString();
}
Program: 118651
Project: 118651
Buggy source:
public static Object getParameterValue(IElement element,Property property){
  Object paramValue=property.getValue() != null ? property.getValue() : property.getDefaultValue();
  Property.Type propertyType=property.getType();
switch (propertyType) {
case STRING:
    if (!(element instanceof FakeElement)) {
      paramValue=TalendQuoteUtils.addQuotesIfNotExist((String)paramValue);
    }
  break;
case ENUM:
if (paramValue == null) {
  List<?> possibleValues=property.getPossibleValues();
  if (possibleValues != null && possibleValues.size() > 0) {
    paramValue=possibleValues.get(0);
    property.setValue(paramValue);
  }
}
break;
default :
break;
}
return paramValue;
}

Fixed version (ground truth):
public static Object getParameterValue(IElement element,Property property){
  Object paramValue=property.getValue() != null ? property.getValue() : property.getDefaultValue();
  Property.Type propertyType=property.getType();
switch (propertyType) {
case STRING:
    if (!(element instanceof FakeElement || ContextParameterUtils.isContainContextParam((String)paramValue))) {
      paramValue=TalendQuoteUtils.addQuotesIfNotExist((String)paramValue);
    }
  break;
case ENUM:
if (paramValue == null) {
  List<?> possibleValues=property.getPossibleValues();
  if (possibleValues != null && possibleValues.size() > 0) {
    paramValue=possibleValues.get(0);
    property.setValue(paramValue);
  }
}
break;
default :
break;
}
return paramValue;
}
Program: 118653
Project: 118653
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,node.getComponentProperties(),null,form,null,null);
  ComponentService componentService=new ComponentServiceWithValueEvaluator(ComponentsUtils.getComponentService(),new ComponentContextPropertyValueEvaluator(node));
  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,category,node.getComponentProperties(),form);
  ComponentService componentService=new ComponentServiceWithValueEvaluator(ComponentsUtils.getComponentService(),new ComponentContextPropertyValueEvaluator(node));
  for (  ElementParameter parameter : parameters) {
    if (parameter instanceof GenericElementParameter) {
      GenericElementParameter genericElementParameter=(GenericElementParameter)parameter;
      genericElementParameter.setComponentService(componentService);
    }
  }
  listParam.addAll(parameters);
}
Program: 118656
Project: 118656
Buggy source:
@Override public void propertyChange(PropertyChangeEvent event){
  String propertyName=event.getPropertyName();
  if (IElementParameterEventProperties.EVENT_PROPERTY_VALUE_CHANGED.equals(propertyName)) {
    reset(true);
  }
 else   if (IElementParameterEventProperties.EVENT_PROPERTY_NAME_CHANGED.equals(propertyName)) {
    String newPropertyName=String.valueOf(event.getNewValue());
    updateProperty(newPropertyName);
  }
 else   if (IElementParameterEventProperties.EVENT_VALIDATE_RESULT_UPDATE.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ValidationResult) {
      updateValidationStatus((ValidationResult)newValue);
    }
  }
 else   if (IElementParameterEventProperties.EVENT_SHOW_DIALOG.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof Form) {
      new GenericDialog(getShell(),(Form)newValue).open();
    }
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_EXPORT_CONTEXT.equals(propertyName)) {
    resetComponentProperties();
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_REFRESH_UI.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ComponentProperties) {
      ComponentProperties newComponentProperties=(ComponentProperties)newValue;
      form.getProperties().copyValuesFrom(newComponentProperties);
      reset(true);
    }
  }
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent event){
  String propertyName=event.getPropertyName();
  if (IElementParameterEventProperties.EVENT_PROPERTY_VALUE_CHANGED.equals(propertyName)) {
    reset(true);
  }
 else   if (IElementParameterEventProperties.EVENT_PROPERTY_NAME_CHANGED.equals(propertyName)) {
    String newPropertyName=String.valueOf(event.getNewValue());
    updateProperty(newPropertyName);
  }
 else   if (IElementParameterEventProperties.EVENT_VALIDATE_RESULT_UPDATE.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ValidationResult) {
      updateValidationStatus((ValidationResult)newValue);
    }
  }
 else   if (IElementParameterEventProperties.EVENT_SHOW_DIALOG.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof Form) {
      GenericDialog genericDialog=new GenericDialog(getShell(),(Form)newValue);
      genericDialog.setConnectionItem(connectionItem);
      genericDialog.open();
    }
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_EXPORT_CONTEXT.equals(propertyName)) {
    resetComponentProperties();
  }
 else   if (IContextEventProperties.EVENT_PROPERTY_REFRESH_UI.equals(propertyName)) {
    Object newValue=event.getNewValue();
    if (newValue instanceof ComponentProperties) {
      ComponentProperties newComponentProperties=(ComponentProperties)newValue;
      form.getProperties().copyValuesFrom(newComponentProperties);
      reset(true);
    }
  }
}
Program: 118657
Project: 118657
Buggy source:
@Override protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  Composite comp=new Composite(composite,SWT.NONE);
  comp.setLayoutData(new GridData(GridData.FILL_BOTH));
  comp.setLayout(new FormLayout());
  Element element=new FakeElement(form.getName());
  dynamicComposite=new DynamicComposite(comp,SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS,EComponentCategory.BASIC,element,true,comp.getBackground(),form,true);
  FormData data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(100,0);
  data.top=new FormAttachment(0,0);
  data.bottom=new FormAttachment(100,0);
  dynamicComposite.setLayoutData(data);
  init();
  return parent;
}

Fixed version (ground truth):
@Override protected Control createDialogArea(Composite parent){
  Composite composite=(Composite)super.createDialogArea(parent);
  Composite comp=new Composite(composite,SWT.NONE);
  comp.setLayoutData(new GridData(GridData.FILL_BOTH));
  comp.setLayout(new FormLayout());
  Element element=new FakeElement(form.getName());
  dynamicComposite=new DynamicComposite(comp,SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS,EComponentCategory.BASIC,element,true,comp.getBackground(),form,true);
  FormData data=new FormData();
  data.left=new FormAttachment(0,0);
  data.right=new FormAttachment(100,0);
  data.top=new FormAttachment(0,0);
  data.bottom=new FormAttachment(100,0);
  dynamicComposite.setLayoutData(data);
  dynamicComposite.setConnectionItem(connectionItem);
  init();
  return parent;
}
Program: 118658
Project: 118658
Buggy source:
public List<ElementParameter> getContextParameters(){
  List<ElementParameter> contextParameters=new ArrayList<>();
  for (  ElementParameter parameter : parameters) {
    if (parameter instanceof GenericElementParameter) {
      GenericElementParameter genericElementParameter=(GenericElementParameter)parameter;
      if (genericElementParameter.isSupportContext() && genericElementParameter.isShow(parameters)) {
        contextParameters.add(parameter);
      }
    }
  }
  return contextParameters;
}

Fixed version (ground truth):
public List<ElementParameter> getContextParameters(){
  List<ElementParameter> contextParameters=new ArrayList<>();
  for (  ElementParameter parameter : parameters) {
    if (parameter instanceof GenericElementParameter) {
      GenericElementParameter genericElementParameter=(GenericElementParameter)parameter;
      if (genericElementParameter.isSupportContext()) {
        contextParameters.add(parameter);
      }
      List<ElementParameter> relatedParameters=ComponentsUtils.getRelatedParameters(genericElementParameter);
      for (      ElementParameter relatedParameter : relatedParameters) {
        if (relatedParameter instanceof GenericElementParameter && ((GenericElementParameter)relatedParameter).isSupportContext()) {
          contextParameters.add(relatedParameter);
        }
      }
    }
  }
  return contextParameters;
}
Program: 118659
Project: 118659
Buggy source:
public static List<IContextParameter> createContextParameters(String prefixName,Connection connection,Set<IConnParamName> paramSet){
  List<IContextParameter> varList=new ArrayList<>();
  if (connection instanceof GenericConnection) {
    GenericConnection conn=(GenericConnection)connection;
    if (conn == null || prefixName == null || paramSet == null || paramSet.isEmpty()) {
      return Collections.emptyList();
    }
    String paramPrefix=prefixName + ConnectionContextHelper.LINE;
    String paramName=null;
    for (    IConnParamName param : paramSet) {
      if (param instanceof GenericConnParamName) {
        GenericConnParamName connParamName=(GenericConnParamName)param;
        String name=connParamName.getName();
        ComponentProperties componentProperties=getComponentProperties((GenericConnection)connection);
        Object paramValue=ComponentsUtils.getGenericPropertyValue(componentProperties,name);
        paramName=paramPrefix + connParamName.getContextVar();
        ConnectionContextHelper.createParameters(varList,paramName,String.valueOf(paramValue));
      }
    }
  }
  return varList;
}

Fixed version (ground truth):
public static List<IContextParameter> createContextParameters(String prefixName,Connection connection,Set<IConnParamName> paramSet){
  List<IContextParameter> varList=new ArrayList<>();
  if (connection instanceof GenericConnection) {
    GenericConnection conn=(GenericConnection)connection;
    if (conn == null || prefixName == null || paramSet == null || paramSet.isEmpty()) {
      return Collections.emptyList();
    }
    String paramPrefix=prefixName + ConnectionContextHelper.LINE;
    String paramName=null;
    for (    IConnParamName param : paramSet) {
      if (param instanceof GenericConnParamName) {
        GenericConnParamName connParamName=(GenericConnParamName)param;
        String name=connParamName.getName();
        ComponentProperties componentProperties=getComponentProperties((GenericConnection)connection);
        Object paramValue=ComponentsUtils.getGenericPropertyValue(componentProperties,name);
        paramName=paramPrefix + connParamName.getContextVar();
        String value=paramValue == null ? null : String.valueOf(paramValue);
        ConnectionContextHelper.createParameters(varList,paramName,value);
      }
    }
  }
  return varList;
}
Program: 118662
Project: 118662
Buggy source:
private Object getGenericRepositoryValue(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) {
        return property.getValue() != null ? property.getValue() : property.getDefaultValue();
      }
    }
    if (value.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return getGenericRepositoryValue(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) {
    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.getValue() != null ? property.getValue() : property.getDefaultValue();
        if (Property.Type.STRING.equals(property.getType()) && paramValue != null) {
          return getRepositoryValueOfStringType(connection,StringUtils.trimToNull(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: 118663
Project: 118663
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(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),value,table);
      }
    }
  }
  return null;
}
Program: 118664
Project: 118664
Buggy source:
public Command createCommand(Button button){
  DateDialog dateDial=new DateDialog(composite.getShell());
  int returnValue=dateDial.open();
  if (returnValue == DateDialog.OK) {
    String propertyName=(String)button.getData(PARAMETER_NAME);
    String date=dateDial.getTalendDateString();
    if (!elem.getPropertyValue(propertyName).equals(date)) {
      elem.setPropertyValue(EParameterName.UPDATE_COMPONENTS.getName(),Boolean.TRUE);
      return new PropertyChangeCommand(elem,propertyName,TalendTextUtils.addQuotes(date));
    }
  }
  return null;
}

Fixed version (ground truth):
public Command createCommand(Button button){
  DateDialog dateDial=new DateDialog(composite.getShell());
  int returnValue=dateDial.open();
  if (returnValue == DateDialog.OK) {
    String propertyName=(String)button.getData(PARAMETER_NAME);
    String date=dateDial.getTalendDateString();
    if (date != null && !date.equals(elem.getPropertyValue(propertyName))) {
      elem.setPropertyValue(EParameterName.UPDATE_COMPONENTS.getName(),Boolean.TRUE);
      return new PropertyChangeCommand(elem,propertyName,TalendTextUtils.addQuotes(date));
    }
  }
  return null;
}
Program: 118665
Project: 118665
Buggy source:
@Override public void refresh(IElementParameter param,boolean checkErrorsWhenViewRefreshed){
  final String name2=param.getName();
  Text labelText=(Text)hashCurControls.get(name2);
  Object value=param.getValue();
  if (labelText == null || labelText.isDisposed()) {
    return;
  }
  boolean valueChanged=false;
  if (value == null) {
    labelText.setText("String_Node_Str");
  }
 else {
    if (!value.equals(labelText.getText())) {
      labelText.setText((String)value);
      valueChanged=true;
    }
  }
  if (checkErrorsWhenViewRefreshed || valueChanged) {
    checkErrorsForPropertiesOnly(labelText);
  }
  fixedCursorPosition(param,labelText,value,valueChanged);
}

Fixed version (ground truth):
@Override public void refresh(IElementParameter param,boolean checkErrorsWhenViewRefreshed){
  final String name2=param.getName();
  Text labelText=(Text)hashCurControls.get(name2);
  Object value=param.getValue();
  if (labelText == null || labelText.isDisposed()) {
    return;
  }
  boolean valueChanged=false;
  if (value == null) {
    labelText.setText(TalendQuoteUtils.addQuotes("String_Node_Str"));
  }
 else {
    if (!value.equals(labelText.getText())) {
      labelText.setText((String)value);
      valueChanged=true;
    }
  }
  if (checkErrorsWhenViewRefreshed || valueChanged) {
    checkErrorsForPropertiesOnly(labelText);
  }
  fixedCursorPosition(param,labelText,value,valueChanged);
}
Program: 118671
Project: 118671
Buggy source:
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    return getGenericRepositoryValue((GenericConnection)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(wizardService.getAllComponentProperties(connection),value,table);
      }
    }
  }
  return null;
}
Program: 118672
Project: 118672
Buggy source:
@Override public boolean isGenericRepositoryValue(List<ComponentProperties> componentProperties,String paramName){
  if (componentProperties != null && paramName != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property property=compPro.getValuedProperty(paramName);
      if (property != null) {
        return property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isGenericRepositoryValue(List<ComponentProperties> componentProperties,String paramName){
  if (componentProperties != null && paramName != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property property=compPro.getValuedProperty(paramName);
      if (property != null) {
        return property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null;
      }
    }
    if (paramName.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return isGenericRepositoryValue(componentProperties,paramName.substring(paramName.indexOf(IGenericConstants.EXP_SEPARATOR) + 1));
    }
  }
  return false;
}
Program: 118674
Project: 118674
Buggy source:
@Override public void generateItemFiles(boolean withDependencies,IProgressMonitor monitor) throws Exception {
  if (!isOptionChoosed(ExportChoice.needJobItem)) {
    return;
  }
  IFolder baseFolder=talendProcessJavaProject.getItemsFolder();
  baseFolder=baseFolder.getFolder(JavaResourcesHelper.getJobFolderName(processItem.getProperty().getLabel(),processItem.getProperty().getVersion()));
  if (baseFolder.exists()) {
    talendProcessJavaProject.cleanFolder(monitor,baseFolder);
  }
 else {
    baseFolder.create(true,true,null);
  }
  IFolder itemsFolder=baseFolder.getFolder("String_Node_Str");
  itemsFolder.create(true,true,monitor);
  List<Item> items=new ArrayList<Item>();
  items.add(processItem);
  ExportItemUtil exportItemUtil=new ExportItemUtil();
  if (withDependencies) {
    Collection<IRepositoryViewObject> allProcessDependencies=ProcessUtils.getAllProcessDependencies(items);
    for (    IRepositoryViewObject repositoryObject : allProcessDependencies) {
      items.add(repositoryObject.getProperty().getItem());
    }
  }
  File destination=new File(itemsFolder.getLocation().toFile().getAbsolutePath());
  exportItemUtil.setProjectNameAsLowerCase(isProjectNameLowerCase());
  exportItemUtil.exportItems(destination,new ArrayList<Item>(items),false,new NullProgressMonitor());
  addDQDependencies(itemsFolder,items);
  addTDMDependencies(itemsFolder,items);
}

Fixed version (ground truth):
@Override public void generateItemFiles(boolean withDependencies,IProgressMonitor monitor) throws Exception {
  IFolder baseFolder=talendProcessJavaProject.getItemsFolder();
  baseFolder=baseFolder.getFolder(JavaResourcesHelper.getJobFolderName(processItem.getProperty().getLabel(),processItem.getProperty().getVersion()));
  if (baseFolder.exists()) {
    talendProcessJavaProject.cleanFolder(monitor,baseFolder);
  }
 else {
    baseFolder.create(true,true,null);
  }
  IFolder itemsFolder=baseFolder.getFolder("String_Node_Str");
  itemsFolder.create(true,true,monitor);
  List<Item> items=new ArrayList<Item>();
  items.add(processItem);
  if (isOptionChoosed(ExportChoice.needJobItem)) {
    ExportItemUtil exportItemUtil=new ExportItemUtil();
    if (withDependencies) {
      Collection<IRepositoryViewObject> allProcessDependencies=ProcessUtils.getAllProcessDependencies(items);
      for (      IRepositoryViewObject repositoryObject : allProcessDependencies) {
        items.add(repositoryObject.getProperty().getItem());
      }
    }
    File destination=new File(itemsFolder.getLocation().toFile().getAbsolutePath());
    exportItemUtil.setProjectNameAsLowerCase(isProjectNameLowerCase());
    exportItemUtil.exportItems(destination,new ArrayList<Item>(items),false,new NullProgressMonitor());
  }
  addDQDependencies(itemsFolder,items);
  addTDMDependencies(itemsFolder,items);
}
Program: 118678
Project: 118678
Buggy source:
/** 
 * DOC qzhang Comment method "loadComponentsFromExtensions".
 */
private void loadComponentsFromExtensions(){
  AbstractProcessProvider.loadComponentsFromProviders();
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "loadComponentsFromExtensions".
 */
private void loadComponentsFromExtensions(){
  AbstractProcessProvider.loadComponentsFromProviders();
  GenericProcessProvider.getInstance().loadComponentsFromProviders();
}
Program: 118679
Project: 118679
Buggy source:
public static Collection<AbstractProcessProvider> findAllProcessProviders(){
  if (providerMap.isEmpty()) {
    IConfigurationElement[] elems=Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
    for (    IConfigurationElement elem : elems) {
      String pid=elem.getAttribute(ATTR_PID);
      try {
        AbstractProcessProvider createExecutableExtension=(AbstractProcessProvider)elem.createExecutableExtension(ATTR_CLASS);
        providerMap.put(pid,createExecutableExtension);
      }
 catch (      CoreException ex) {
        ExceptionHandler.process(ex);
      }
    }
  }
  return providerMap.values();
}

Fixed version (ground truth):
public static Collection<AbstractProcessProvider> findAllProcessProviders(){
  if (providerMap.isEmpty()) {
    IConfigurationElement[] elems=Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
    for (    IConfigurationElement elem : elems) {
      String pid=elem.getAttribute(ATTR_PID);
      try {
        Object provider=elem.createExecutableExtension(ATTR_CLASS);
        if (provider instanceof AbstractProcessProvider) {
          AbstractProcessProvider createExecutableExtension=(AbstractProcessProvider)provider;
          providerMap.put(pid,createExecutableExtension);
        }
      }
 catch (      CoreException ex) {
        ExceptionHandler.process(ex);
      }
    }
  }
  return providerMap.values();
}
Program: 118680
Project: 118680
Buggy source:
public static PaletteRoot createPalletteForMapReduce(IComponentsFactory compFac,PaletteRoot root){
  palette=root;
  int histate=DesignerPlugin.getDefault().getPreferenceStore().getInt("String_Node_Str");
  AbstractProcessProvider.loadComponentsFromProviders();
  createComponentsDrawer(compFac,false,histate);
  return palette;
}

Fixed version (ground truth):
public static PaletteRoot createPalletteForMapReduce(IComponentsFactory compFac,PaletteRoot root){
  palette=root;
  int histate=DesignerPlugin.getDefault().getPreferenceStore().getInt("String_Node_Str");
  AbstractProcessProvider.loadComponentsFromProviders();
  GenericProcessProvider.getInstance().loadComponentsFromProviders();
  createComponentsDrawer(compFac,false,histate);
  return palette;
}
Program: 118681
Project: 118681
Buggy source:
public static PaletteRoot createPalette(final IComponentsFactory compFac,PaletteRoot root,boolean isFavorite){
  int histate=DesignerPlugin.getDefault().getPreferenceStore().getInt("String_Node_Str");
  palette=root;
  AbstractProcessProvider.loadComponentsFromProviders();
  createComponentsDrawer(compFac,false,isFavorite,histate);
  return palette;
}

Fixed version (ground truth):
public static PaletteRoot createPalette(final IComponentsFactory compFac,PaletteRoot root,boolean isFavorite){
  int histate=DesignerPlugin.getDefault().getPreferenceStore().getInt("String_Node_Str");
  palette=root;
  AbstractProcessProvider.loadComponentsFromProviders();
  GenericProcessProvider.getInstance().loadComponentsFromProviders();
  createComponentsDrawer(compFac,false,isFavorite,histate);
  return palette;
}
Program: 118682
Project: 118682
Buggy source:
public static PaletteRoot getAllNodeStructure(final IComponentsFactory compFac){
  palette=new PaletteRoot();
  AbstractProcessProvider.loadComponentsFromProviders();
  createComponentsDrawer(compFac,true,0);
  return palette;
}

Fixed version (ground truth):
public static PaletteRoot getAllNodeStructure(final IComponentsFactory compFac){
  palette=new PaletteRoot();
  AbstractProcessProvider.loadComponentsFromProviders();
  GenericProcessProvider.getInstance().loadComponentsFromProviders();
  createComponentsDrawer(compFac,true,0);
  return palette;
}
Program: 118687
Project: 118687
Buggy source:
@Override public Object getComponentValue(Connection connection,String value,IMetadataTable table,String targetComponent){
  if (value != null && canHandle(connection)) {
    return getGenericRepositoryValue((GenericConnection)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(wizardService.getAllComponentProperties(connection),value,table);
      }
    }
  }
  return null;
}
Program: 118688
Project: 118688
Buggy source:
@Override public boolean isGenericRepositoryValue(List<ComponentProperties> componentProperties,String paramName){
  if (componentProperties != null && paramName != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property property=compPro.getValuedProperty(paramName);
      if (property != null) {
        return property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isGenericRepositoryValue(List<ComponentProperties> componentProperties,String paramName){
  if (componentProperties != null && paramName != null) {
    for (    ComponentProperties compPro : componentProperties) {
      Property property=compPro.getValuedProperty(paramName);
      if (property != null) {
        return property.getTaggedValue(IGenericConstants.REPOSITORY_VALUE) != null;
      }
    }
    if (paramName.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
      return isGenericRepositoryValue(componentProperties,paramName.substring(paramName.indexOf(IGenericConstants.EXP_SEPARATOR) + 1));
    }
  }
  return false;
}
Program: 118689
Project: 118689
Buggy source:
private void updateSchema(){
  IElement element=this.getElement();
  if (element instanceof Node) {
    Node node=(Node)element;
    List<IMetadataTable> metadataList=node.getMetadataList();
    if (metadataList.size() > 0) {
      IMetadataTable oldTable=metadataList.get(0);
      String schemaPropertyName=oldTable.getAdditionalProperties().get(IGenericConstants.COMPONENT_SCHEMA_TAG);
      Object schemaObj=null;
      try {
        schemaObj=ComponentsUtils.getGenericPropertyValue(componentProperties,schemaPropertyName);
      }
 catch (      Exception e) {
      }
      if (schemaObj != null && schemaObj instanceof Schema) {
        MetadataTable metadataTable=SchemaUtils.createSchema(String.valueOf(getValue()),componentProperties,schemaPropertyName);
        IMetadataTable newTable=MetadataToolHelper.convert(metadataTable);
        if (!newTable.sameMetadataAs(oldTable)) {
          IElementParameter schemaParameter=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
          ChangeMetadataCommand cmd=new ChangeMetadataCommand(node,schemaParameter,oldTable,newTable,null);
          IProcess process=node.getProcess();
          if (process instanceof org.talend.designer.core.ui.editor.process.Process) {
            CommandStack commandStack=((org.talend.designer.core.ui.editor.process.Process)process).getCommandStack();
            commandStack.execute(cmd);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void updateSchema(){
  IElement element=this.getElement();
  if (element instanceof Node) {
    Node node=(Node)element;
    List<IMetadataTable> metadataList=node.getMetadataList();
    if (metadataList.size() > 0) {
      IMetadataTable oldTable=metadataList.get(0);
      String schemaPropertyName=oldTable.getAdditionalProperties().get(IComponentConstants.COMPONENT_SCHEMA_TAG);
      Object schemaObj=null;
      try {
        schemaObj=ComponentsUtils.getGenericPropertyValue(componentProperties,schemaPropertyName);
      }
 catch (      Exception e) {
      }
      if (schemaObj != null && schemaObj instanceof Schema) {
        MetadataTable metadataTable=SchemaUtils.createSchema(String.valueOf(getValue()),componentProperties,schemaPropertyName);
        IMetadataTable newTable=MetadataToolHelper.convert(metadataTable);
        if (!newTable.sameMetadataAs(oldTable)) {
          IElementParameter schemaParameter=node.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
          ChangeMetadataCommand cmd=new ChangeMetadataCommand(node,schemaParameter,oldTable,newTable,null);
          IProcess process=node.getProcess();
          if (process instanceof org.talend.designer.core.ui.editor.process.Process) {
            CommandStack commandStack=((org.talend.designer.core.ui.editor.process.Process)process).getCommandStack();
            commandStack.execute(cmd);
          }
        }
      }
    }
  }
}
Program: 118690
Project: 118690
Buggy source:
public static ComponentProperties getCurrentComponentProperties(IMetadataTable table){
  if (table != null) {
    String serializedProperties=null;
    if (table instanceof MetadataTableRepositoryObject) {
      MetadataTableRepositoryObject metaTableRepObj=(MetadataTableRepositoryObject)table;
      MetadataTable metadataTable=metaTableRepObj.getTable();
      if (metadataTable != null && metadataTable.getTaggedValue() != null) {
        for (        TaggedValue serializedProps : metadataTable.getTaggedValue()) {
          if (IGenericConstants.COMPONENT_PROPERTIES_TAG.equals(serializedProps.getTag())) {
            serializedProperties=serializedProps.getValue();
            break;
          }
        }
      }
    }
 else     if (table instanceof org.talend.core.model.metadata.MetadataTable) {
      org.talend.core.model.metadata.MetadataTable metaTable=(org.talend.core.model.metadata.MetadataTable)table;
      Map<String,String> additionalProperties=metaTable.getAdditionalProperties();
      serializedProperties=additionalProperties.get(IGenericConstants.COMPONENT_PROPERTIES_TAG);
    }
    if (serializedProperties != null) {
      Deserialized<ComponentProperties> fromSerializedProperties=ComponentProperties.fromSerialized(serializedProperties,ComponentProperties.class);
      if (fromSerializedProperties != null) {
        return fromSerializedProperties.properties;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static ComponentProperties getCurrentComponentProperties(IMetadataTable table){
  if (table != null) {
    String serializedProperties=null;
    if (table instanceof MetadataTableRepositoryObject) {
      MetadataTableRepositoryObject metaTableRepObj=(MetadataTableRepositoryObject)table;
      MetadataTable metadataTable=metaTableRepObj.getTable();
      if (metadataTable != null && metadataTable.getTaggedValue() != null) {
        for (        TaggedValue serializedProps : metadataTable.getTaggedValue()) {
          if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(serializedProps.getTag())) {
            serializedProperties=serializedProps.getValue();
            break;
          }
        }
      }
    }
 else     if (table instanceof org.talend.core.model.metadata.MetadataTable) {
      org.talend.core.model.metadata.MetadataTable metaTable=(org.talend.core.model.metadata.MetadataTable)table;
      Map<String,String> additionalProperties=metaTable.getAdditionalProperties();
      serializedProperties=additionalProperties.get(IComponentConstants.COMPONENT_PROPERTIES_TAG);
    }
    if (serializedProperties != null) {
      Deserialized<ComponentProperties> fromSerializedProperties=ComponentProperties.fromSerialized(serializedProperties,ComponentProperties.class);
      if (fromSerializedProperties != null) {
        return fromSerializedProperties.properties;
      }
    }
  }
  return null;
}
Program: 118691
Project: 118691
Buggy source:
public static MetadataTable createSchema(String name,ComponentProperties properties,String schemaPropertyName){
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  MetadataTable metadataTable=ConnectionFactory.eINSTANCE.createMetadataTable();
  metadataTable.setId(factory.getNextId());
  metadataTable.setName(name);
  metadataTable.setLabel(name);
  metadataTable.setSourceName(name);
  TaggedValue serializedPropsTV=CoreFactory.eINSTANCE.createTaggedValue();
  serializedPropsTV.setTag(IGenericConstants.COMPONENT_PROPERTIES_TAG);
  serializedPropsTV.setValue(properties.toSerialized());
  metadataTable.getTaggedValue().add(serializedPropsTV);
  TaggedValue schemaPropertyTV=CoreFactory.eINSTANCE.createTaggedValue();
  schemaPropertyTV.setTag(IGenericConstants.COMPONENT_SCHEMA_TAG);
  schemaPropertyTV.setValue(schemaPropertyName);
  metadataTable.getTaggedValue().add(schemaPropertyTV);
  Object schemaObj=ComponentsUtils.getGenericPropertyValue(properties,schemaPropertyName);
  if (schemaObj instanceof String) {
    Schema avroSchema=new Schema.Parser().parse((String)schemaObj);
    convertComponentSchemaIntoTalendSchema(avroSchema,metadataTable);
  }
  return metadataTable;
}

Fixed version (ground truth):
public static MetadataTable createSchema(String name,ComponentProperties properties,String schemaPropertyName){
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  MetadataTable metadataTable=ConnectionFactory.eINSTANCE.createMetadataTable();
  metadataTable.setId(factory.getNextId());
  metadataTable.setName(name);
  metadataTable.setLabel(name);
  metadataTable.setSourceName(name);
  TaggedValue serializedPropsTV=CoreFactory.eINSTANCE.createTaggedValue();
  serializedPropsTV.setTag(IComponentConstants.COMPONENT_PROPERTIES_TAG);
  serializedPropsTV.setValue(properties.toSerialized());
  metadataTable.getTaggedValue().add(serializedPropsTV);
  TaggedValue schemaPropertyTV=CoreFactory.eINSTANCE.createTaggedValue();
  schemaPropertyTV.setTag(IComponentConstants.COMPONENT_SCHEMA_TAG);
  schemaPropertyTV.setValue(schemaPropertyName);
  metadataTable.getTaggedValue().add(schemaPropertyTV);
  Object schemaObj=ComponentsUtils.getGenericPropertyValue(properties,schemaPropertyName);
  if (schemaObj instanceof String) {
    Schema avroSchema=new Schema.Parser().parse((String)schemaObj);
    convertComponentSchemaIntoTalendSchema(avroSchema,metadataTable);
  }
  return metadataTable;
}
Program: 118692
Project: 118692
Buggy source:
public static void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable){
  Schema schema=convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
  componentProperties.setValue(schemaPropertyName,schema);
  Map<String,String> additionalProperties=metadataTable.getAdditionalProperties();
  additionalProperties.put(IGenericConstants.COMPONENT_PROPERTIES_TAG,componentProperties.toSerialized());
  additionalProperties.put(IGenericConstants.COMPONENT_SCHEMA_TAG,schemaPropertyName);
}

Fixed version (ground truth):
public static void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable){
  Schema schema=convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
  componentProperties.setValue(schemaPropertyName,schema);
  Map<String,String> additionalProperties=metadataTable.getAdditionalProperties();
  additionalProperties.put(IComponentConstants.COMPONENT_PROPERTIES_TAG,componentProperties.toSerialized());
  additionalProperties.put(IComponentConstants.COMPONENT_SCHEMA_TAG,schemaPropertyName);
}
Program: 118697
Project: 118697
Buggy source:
/** 
 * Use the database table wizard to update the schema in the repository.
 * @param button
 */
public void updateRepositorySchema(Button button){
  String paramName=(String)button.getData(PARAMETER_NAME);
  String fullParamName=paramName + "String_Node_Str" + getRepositoryChoiceParamName();
  IElementParameter schemaParam=elem.getElementParameter(fullParamName);
  String schemaId=(String)schemaParam.getValue();
  org.talend.core.model.metadata.builder.connection.Connection connection=MetadataToolHelper.getConnectionFromRepository(schemaId);
  String[] names=schemaId.split("String_Node_Str");
  if (connection == null || names == null || names.length != 2) {
    MessageDialog.openError(composite.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    return;
  }
  IRepositoryViewObject node=findRepositoryObject(schemaId);
  RepositoryNode repositoryNode=RepositoryNodeUtilities.getRepositoryNode(node);
  RepositoryNode metadataNode=null;
  metadataNode=findRepositoryNode(names[1],names[0],repositoryNode);
  if (metadataNode != null) {
    final IMetadataService metadataService=CorePlugin.getDefault().getMetadataService();
    if (metadataService != null) {
      metadataService.runCreateTableAction(metadataNode);
    }
  }
}

Fixed version (ground truth):
/** 
 * Use the database table wizard to update the schema in the repository.
 * @param button
 */
public void updateRepositorySchema(Button button){
  String paramName=(String)button.getData(PARAMETER_NAME);
  String fullParamName=paramName + "String_Node_Str" + getRepositoryChoiceParamName();
  IElementParameter schemaParam=elem.getElementParameter(fullParamName);
  String schemaId=(String)schemaParam.getValue();
  org.talend.core.model.metadata.builder.connection.Connection connection=MetadataToolHelper.getConnectionFromRepository(schemaId);
  String[] names=schemaId.split("String_Node_Str");
  if (connection == null || names == null || names.length != 2) {
    MessageDialog.openError(composite.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
    return;
  }
  IRepositoryViewObject node=findRepositoryObject(schemaId);
  RepositoryNode repositoryNode=null;
  IRepositoryNode iRepNode=RepositorySeekerManager.getInstance().searchRepoViewNode(node.getProperty().getId());
  if (iRepNode instanceof RepositoryNode) {
    repositoryNode=(RepositoryNode)iRepNode;
  }
  if (repositoryNode == null) {
    return;
  }
  RepositoryNode metadataNode=null;
  metadataNode=findRepositoryNode(names[1],names[0],repositoryNode);
  if (metadataNode != null) {
    final IMetadataService metadataService=CorePlugin.getDefault().getMetadataService();
    if (metadataService != null) {
      metadataService.runCreateTableAction(metadataNode);
    }
  }
}
Program: 118703
Project: 118703
Buggy source:
public void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable){
  SchemaUtils.updateComponentSchema(componentProperties,schemaPropertyName,metadataTable);
}

Fixed version (ground truth):
@Override public void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable){
  SchemaUtils.updateComponentSchema(componentProperties,schemaPropertyName,metadataTable);
}