nus-yam/ex-repair huggingface dataset:
Program: 118582
Project: 118582
Buggy source:
public List<List<String>> getTableResult(String tableName,List<String> names){
  List<List<String>> result=new ArrayList<List<String>>();
  Element functionElement=doc.getRootElement();
  if (functionElement == null) {
    return result;
  }
  Element tablesOrChangingElement=functionElement.element("String_Node_Str");
  if (tablesOrChangingElement == null) {
    tablesOrChangingElement=functionElement.element("String_Node_Str");
  }
  if (tablesOrChangingElement == null) {
    return result;
  }
  Element tableElement=tablesOrChangingElement.element(tableName);
  if (tableElement == null) {
    return result;
  }
  List<Element> elements=tableElement.elements("String_Node_Str");
  for (  Element element : elements) {
    List<String> row=new ArrayList<String>();
    for (    String name : names) {
      Element subElement=element.element(name);
      if (subElement == null) {
        row.add(null);
      }
 else {
        row.add(subElement.getText());
      }
    }
    result.add(row);
  }
  return result;
}

Fixed version (ground truth):
public List<List<String>> getTableResult(String tableName,List<String> names){
  List<List<String>> result=new ArrayList<List<String>>();
  Element functionElement=doc.getRootElement();
  if (functionElement == null) {
    return result;
  }
  List<Element> tablesAndChangingElements=new ArrayList<Element>(3);
  tablesAndChangingElements.add(functionElement.element("String_Node_Str"));
  tablesAndChangingElements.add(functionElement.element("String_Node_Str"));
  for (  Element tablesOrChangingElement : tablesAndChangingElements) {
    if (tablesOrChangingElement == null) {
      continue;
    }
    Element tableElement=tablesOrChangingElement.element(tableName);
    if (tableElement == null) {
      continue;
    }
    List<Element> elements=tableElement.elements("String_Node_Str");
    if (elements == null) {
      continue;
    }
    for (    Element element : elements) {
      List<String> row=new ArrayList<String>();
      for (      String name : names) {
        Element subElement=element.element(name);
        if (subElement == null) {
          row.add(null);
        }
 else {
          row.add(subElement.getText());
        }
      }
      result.add(row);
    }
  }
  return result;
}
Program: 118584
Project: 118584
Buggy source:
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);
}

Fixed version (ground truth):
public static void updateComponentSchema(ComponentProperties componentProperties,String schemaPropertyName,IMetadataTable metadataTable,IElementParameter param){
  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);
  if (param != null) {
    param.setValue(schema.toString());
  }
}
Program: 118585
Project: 118585
Buggy source:
private void updateComponentSchema(){
  IGenericWizardService wizardService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
    wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
  }
  if (wizardService != null && schemaParam != null) {
    wizardService.updateComponentSchema(node.getComponentProperties(),schemaParam.getName(),currentOutputMetadata);
  }
}

Fixed version (ground truth):
private void updateComponentSchema(){
  IGenericWizardService wizardService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
    wizardService=(IGenericWizardService)GlobalServiceRegister.getDefault().getService(IGenericWizardService.class);
  }
  if (wizardService != null && schemaParam != null) {
    wizardService.updateComponentSchema(node.getComponentProperties(),schemaParam.getName(),currentOutputMetadata,schemaParam);
  }
}
Program: 118587
Project: 118587
Buggy source:
@Override 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,IElementParameter param){
  SchemaUtils.updateComponentSchema(componentProperties,schemaPropertyName,metadataTable,param);
}
Program: 118589
Project: 118589
Buggy source:
@Override public JSONObject collect() throws Exception {
  JSONObject finalToken=new JSONObject();
  JSONObject mergedData=new JSONObject();
  IPreferenceStore preferenceStore=RepositoryPlugin.getDefault().getPreferenceStore();
  String records=preferenceStore.getString(PREF_TOS_JOBS_RECORDS);
  JSONObject allProjectRecords=null;
  try {
    allProjectRecords=new JSONObject(records);
  }
 catch (  Exception e) {
    allProjectRecords=new JSONObject();
  }
  Iterator<String> keys=allProjectRecords.keys();
  JSONObject projectTypes=new JSONObject();
  while (keys.hasNext()) {
    String projectName=keys.next();
    JSONObject object=(JSONObject)allProjectRecords.get(projectName);
    if (object != null) {
      TokenInforUtil.mergeJSON(object,mergedData);
      String type=object.getString("String_Node_Str");
      if (!projectTypes.has(type)) {
        projectTypes.put(type,1);
      }
 else {
        int nb=projectTypes.getInt(type);
        nb++;
        projectTypes.put(type,nb);
      }
    }
  }
  finalToken.put(PROJECTS_REPOSITORY.getKey(),mergedData.get("String_Node_Str"));
  finalToken.put("String_Node_Str",projectTypes);
  return finalToken;
}

Fixed version (ground truth):
@Override public JSONObject collect() throws Exception {
  JSONObject finalToken=new JSONObject();
  JSONObject mergedData=new JSONObject();
  IPreferenceStore preferenceStore=RepositoryPlugin.getDefault().getPreferenceStore();
  String records=preferenceStore.getString(PREF_TOS_JOBS_RECORDS);
  JSONObject allProjectRecords=null;
  try {
    allProjectRecords=new JSONObject(records);
  }
 catch (  Exception e) {
    allProjectRecords=new JSONObject();
  }
  Iterator<String> keys=allProjectRecords.keys();
  JSONObject projectTypes=new JSONObject();
  while (keys.hasNext()) {
    String projectName=keys.next();
    JSONObject object=(JSONObject)allProjectRecords.get(projectName);
    if (object != null) {
      TokenInforUtil.mergeJSON(object,mergedData);
      if (object.has(TYPE.getKey())) {
        String type=object.getString(TYPE.getKey());
        if (!projectTypes.has(type)) {
          projectTypes.put(type,1);
        }
 else {
          int nb=projectTypes.getInt(type);
          nb++;
          projectTypes.put(type,nb);
        }
      }
    }
  }
  if (mergedData.has(PROJECTS.getKey())) {
    finalToken.put(PROJECTS_REPOSITORY.getKey(),mergedData.get(PROJECTS.getKey()));
  }
  finalToken.put("String_Node_Str",projectTypes);
  return finalToken;
}
Program: 118591
Project: 118591
Buggy source:
/** 
 * DOC aiming Comment method "unZipFile".
 * @param zipfile
 * @param unzipdir
 * @throws Exception
 */
public static void unZipFile(String zipfile,String unzipdir) throws Exception {
  File unzipF=new File(unzipdir);
  if (!unzipF.exists()) {
    unzipF.mkdirs();
  }
  ZipFile zfile=new ZipFile(zipfile);
  Enumeration zList=zfile.entries();
  ZipEntry ze=null;
  byte[] buf=new byte[1024];
  while (zList.hasMoreElements()) {
    ze=(ZipEntry)zList.nextElement();
    if (ze.isDirectory()) {
      File f=new File(unzipdir + ze.getName());
      f.mkdirs();
      continue;
    }
    unzipdir=unzipdir.replace('\\','/');
    if (!unzipdir.endsWith("String_Node_Str")) {
      unzipdir=unzipdir + "String_Node_Str";
    }
    String filename=unzipdir + ze.getName();
    File zeF=new File(filename);
    if (!zeF.getParentFile().exists()) {
      zeF.getParentFile().mkdirs();
    }
    OutputStream os=new BufferedOutputStream(new FileOutputStream(zeF));
    InputStream is=new BufferedInputStream(zfile.getInputStream(ze));
    int readLen=0;
    while ((readLen=is.read(buf,0,1024)) != -1) {
      os.write(buf,0,readLen);
    }
    is.close();
    os.close();
  }
  zfile.close();
}

Fixed version (ground truth):
/** 
 * DOC aiming Comment method "unZipFile".
 * @param zipfile
 * @param unzipdir
 * @throws Exception
 */
public static void unZipFile(String zipfile,String unzipdir) throws Exception {
  File unzipF=new File(unzipdir);
  if (!unzipF.exists()) {
    unzipF.mkdirs();
  }
  ZipFile zfile=new ZipFile(zipfile);
  Enumeration zList=zfile.entries();
  ZipEntry ze=null;
  byte[] buf=new byte[1024];
  while (zList.hasMoreElements()) {
    ze=(ZipEntry)zList.nextElement();
    if (ze.isDirectory()) {
      File f=new File(unzipdir + File.separator + ze.getName());
      f.mkdirs();
      continue;
    }
    unzipdir=unzipdir.replace('\\','/');
    if (!unzipdir.endsWith("String_Node_Str")) {
      unzipdir=unzipdir + "String_Node_Str";
    }
    String filename=unzipdir + ze.getName();
    File zeF=new File(filename);
    if (!zeF.getParentFile().exists()) {
      zeF.getParentFile().mkdirs();
    }
    OutputStream os=new BufferedOutputStream(new FileOutputStream(zeF));
    InputStream is=new BufferedInputStream(zfile.getInputStream(ze));
    int readLen=0;
    while ((readLen=is.read(buf,0,1024)) != -1) {
      os.write(buf,0,readLen);
    }
    is.close();
    os.close();
  }
  zfile.close();
}
Program: 118595
Project: 118595
Buggy source:
@Override public JSONObject collect() throws Exception {
  JSONObject finalToken=new JSONObject();
  JSONObject mergedData=new JSONObject();
  IPreferenceStore preferenceStore=RepositoryPlugin.getDefault().getPreferenceStore();
  String records=preferenceStore.getString(PREF_TOS_JOBS_RECORDS);
  JSONObject allProjectRecords=null;
  try {
    allProjectRecords=new JSONObject(records);
  }
 catch (  Exception e) {
    allProjectRecords=new JSONObject();
  }
  Iterator<String> keys=allProjectRecords.keys();
  JSONObject projectTypes=new JSONObject();
  while (keys.hasNext()) {
    String projectName=keys.next();
    JSONObject object=(JSONObject)allProjectRecords.get(projectName);
    if (object != null) {
      TokenInforUtil.mergeJSON(object,mergedData);
      String type=object.getString("String_Node_Str");
      if (!projectTypes.has(type)) {
        projectTypes.put(type,1);
      }
 else {
        int nb=projectTypes.getInt(type);
        nb++;
        projectTypes.put(type,nb);
      }
    }
  }
  finalToken.put(PROJECTS_REPOSITORY.getKey(),mergedData.get("String_Node_Str"));
  finalToken.put("String_Node_Str",projectTypes);
  return finalToken;
}

Fixed version (ground truth):
@Override public JSONObject collect() throws Exception {
  JSONObject finalToken=new JSONObject();
  JSONObject mergedData=new JSONObject();
  IPreferenceStore preferenceStore=RepositoryPlugin.getDefault().getPreferenceStore();
  String records=preferenceStore.getString(PREF_TOS_JOBS_RECORDS);
  JSONObject allProjectRecords=null;
  try {
    allProjectRecords=new JSONObject(records);
  }
 catch (  Exception e) {
    allProjectRecords=new JSONObject();
  }
  Iterator<String> keys=allProjectRecords.keys();
  JSONObject projectTypes=new JSONObject();
  while (keys.hasNext()) {
    String projectName=keys.next();
    JSONObject object=(JSONObject)allProjectRecords.get(projectName);
    if (object != null) {
      TokenInforUtil.mergeJSON(object,mergedData);
      if (object.has(TYPE.getKey())) {
        String type=object.getString(TYPE.getKey());
        if (!projectTypes.has(type)) {
          projectTypes.put(type,1);
        }
 else {
          int nb=projectTypes.getInt(type);
          nb++;
          projectTypes.put(type,nb);
        }
      }
    }
  }
  if (mergedData.has(PROJECTS.getKey())) {
    finalToken.put(PROJECTS_REPOSITORY.getKey(),mergedData.get(PROJECTS.getKey()));
  }
  finalToken.put("String_Node_Str",projectTypes);
  return finalToken;
}
Program: 118596
Project: 118596
Buggy source:
@Override public void widgetSelected(SelectionEvent event){
  if (!(event.getSource() instanceof CCombo)) {
    return;
  }
  GenericElementParameter gParam=(GenericElementParameter)param;
  ComponentReferenceProperties props=(ComponentReferenceProperties)gParam.getWidget().getContent();
  Command cmd=createComboCommand(event,gParam,props);
  executeCommand(cmd);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent event){
  if (!(event.getSource() instanceof CCombo)) {
    return;
  }
  Command cmd=createComboCommand(event,gParam,props);
  executeCommand(cmd);
}
Program: 118600
Project: 118600
Buggy source:
protected void processCodegenPropInfos(List<CodegenPropInfo> propList,ComponentProperties props,String fieldString){
  for (  NamedThing prop : props.getProperties()) {
    if (prop instanceof ComponentProperties) {
      CodegenPropInfo childPropInfo=new CodegenPropInfo();
      if (fieldString.equals("String_Node_Str")) {
        childPropInfo.fieldName="String_Node_Str" + prop.getName();
      }
 else {
        childPropInfo.fieldName=fieldString + "String_Node_Str" + prop.getName();
      }
      childPropInfo.className=prop.getClass().getName();
      childPropInfo.props=(ComponentProperties)prop;
      propList.add(childPropInfo);
      processCodegenPropInfos(propList,childPropInfo.props,childPropInfo.fieldName);
    }
  }
}

Fixed version (ground truth):
protected void processCodegenPropInfos(List<CodegenPropInfo> propList,ComponentProperties props,String fieldString){
  for (  NamedThing prop : props.getProperties()) {
    if (prop instanceof ComponentProperties) {
      if (prop instanceof ComponentReferenceProperties) {
        ((ComponentReferenceProperties)prop).componentProperties=null;
      }
      CodegenPropInfo childPropInfo=new CodegenPropInfo();
      if (fieldString.equals("String_Node_Str")) {
        childPropInfo.fieldName="String_Node_Str" + prop.getName();
      }
 else {
        childPropInfo.fieldName=fieldString + "String_Node_Str" + prop.getName();
      }
      childPropInfo.className=prop.getClass().getName();
      childPropInfo.props=(ComponentProperties)prop;
      propList.add(childPropInfo);
      processCodegenPropInfos(propList,childPropInfo.props,childPropInfo.fieldName);
    }
  }
}
Program: 118601
Project: 118601
Buggy source:
public String getCodegenValue(Property property,String value){
  if (property.getType() == Property.Type.ENUM) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (property.getType() == Property.Type.SCHEMA) {
    return "String_Node_Str" + value.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  }
  return value;
}

Fixed version (ground truth):
public String getCodegenValue(Property property,String value){
  if (Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.ADD_QUOTES)))) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (property.getType() == Property.Type.ENUM) {
    return "String_Node_Str" + value + "String_Node_Str";
  }
  if (property.getType() == Property.Type.SCHEMA) {
    return "String_Node_Str" + value.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str") + "String_Node_Str";
  }
  return value;
}
Program: 118602
Project: 118602
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(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_REFERENCE);
          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);
        if (schemaObj instanceof String) {
          schemaObj=new Schema.Parser().parse((String)schemaObj);
        }
      }
 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_REFERENCE);
          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: 118603
Project: 118603
Buggy source:
@Override public void setValue(Object o){
  super.setValue(o);
  if (!isFirstCall) {
    updateProperty(o);
    boolean calledValidate=callValidate();
    if (calledValidate) {
      fireValidateStatusEvent();
    }
    boolean calledAfter=callAfter();
    if (calledAfter) {
      fireValueChangedEvent();
    }
  }
  isFirstCall=false;
}

Fixed version (ground truth):
@Override public void setValue(Object o){
  super.setValue(o);
  if (!isFirstCall || widget.getContent() instanceof ComponentProperties) {
    updateProperty(o);
    boolean calledValidate=callValidate();
    if (calledValidate) {
      fireValidateStatusEvent();
    }
    boolean calledAfter=callAfter();
    if (calledAfter) {
      fireValueChangedEvent();
    }
  }
  isFirstCall=false;
}
Program: 118604
Project: 118604
Buggy source:
/** 
 * qzhang Comment method "resetValues".
 * @param host
 */
private void resetValues(final Text key,final Text value){
  final IContext context=contextManager.getContext(contextCombo.getItem(contextCombo.getSelectionIndex()));
  value.setText(CONTEXT_WITH + ContextParameterUtils.parseScriptContextCode(key.getText(),context));
}

Fixed version (ground truth):
/** 
 * qzhang Comment method "resetValues".
 * @param host
 */
private void resetValues(final Text key,final Text value){
  final IContext context=contextManager.getContext(contextCombo.getItem(contextCombo.getSelectionIndex()));
  value.setText(ContextParameterUtils.parseScriptContextCode(key.getText(),context));
}
Program: 118606
Project: 118606
Buggy source:
@Override public void keyReleased(KeyEvent e){
  if (isRequriedValue(key.getName())) {
    if (host.getText().trim().length() == 0) {
      host.setBackground(ColorConstants.red);
      host.redraw();
    }
 else {
      host.setBackground(ColorConstants.white);
      host.redraw();
    }
    resetValues(host,hostText);
  }
}

Fixed version (ground truth):
@Override public void keyReleased(KeyEvent e){
  if (isRequriedValue(key.getName())) {
    if (host.getText().trim().length() == 0) {
      host.setBackground(ColorConstants.red);
      host.redraw();
    }
 else {
      host.setBackground(ColorConstants.white);
      host.redraw();
    }
    resetValues(host,hostValue);
  }
}
Program: 118608
Project: 118608
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(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);
          }
        }
      }
    }
  }
}

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_REFERENCE);
          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: 118613
Project: 118613
Buggy source:
private static IMetadataTable getSchemaTablefromComponent(final String componentName,final String tableName){
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get(componentName,ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  for (int k=0; k < tmpNode.getElementParameters().size(); k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=null;
        if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
          table=((IMetadataTable)value).clone(true);
        }
 else {
          table=((IMetadataTable)value).clone();
        }
        table.setTableName(tableName);
        table.setAttachedConnector(currentParam.getContext());
        for (        IMetadataColumn column : table.getListColumns()) {
          column.setDefault("String_Node_Str");
        }
        return table;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private static IMetadataTable getSchemaTablefromComponent(final String componentName,final String tableName){
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get(componentName,ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  for (int k=0; k < tmpNode.getElementParameters().size(); k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=null;
        if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
          table=((IMetadataTable)value).clone(true);
        }
 else {
          table=((IMetadataTable)value).clone();
        }
        table.setTableName(tableName);
        table.setAttachedConnector(currentParam.getContext());
        for (        IMetadataColumn column : table.getListColumns()) {
          column.setDefault("String_Node_Str");
        }
        return table;
      }
    }
  }
  return null;
}
Program: 118614
Project: 118614
Buggy source:
private static DataNode createLogsNode(boolean useFile,boolean console,String dbOutput){
  JobLogsComponent logsComponent=new JobLogsComponent(useFile,console,dbOutput);
  DataNode logsNode=new DataNode(logsComponent,LOG_UNIQUE_NAME);
  logsNode.setStart(true);
  logsNode.setSubProcessStart(true);
  logsNode.setActivate(true);
  logsNode.getMetadataList().clear();
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get("String_Node_Str",ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  boolean found=false;
  for (int k=0; k < tmpNode.getElementParameters().size() && !found; k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=((IMetadataTable)value).clone();
        table.setTableName(LOG_UNIQUE_NAME);
        table.setAttachedConnector(currentParam.getContext());
        logsNode.getMetadataList().add(table);
      }
      found=true;
    }
  }
  return logsNode;
}

Fixed version (ground truth):
private static DataNode createLogsNode(boolean useFile,boolean console,String dbOutput){
  JobLogsComponent logsComponent=new JobLogsComponent(useFile,console,dbOutput);
  DataNode logsNode=new DataNode(logsComponent,LOG_UNIQUE_NAME);
  logsNode.setStart(true);
  logsNode.setSubProcessStart(true);
  logsNode.setActivate(true);
  logsNode.getMetadataList().clear();
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get("String_Node_Str",ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  boolean found=false;
  for (int k=0; k < tmpNode.getElementParameters().size() && !found; k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=((IMetadataTable)value).clone();
        table.setTableName(LOG_UNIQUE_NAME);
        table.setAttachedConnector(currentParam.getContext());
        logsNode.getMetadataList().add(table);
      }
      found=true;
    }
  }
  return logsNode;
}
Program: 118615
Project: 118615
Buggy source:
private static DataNode createMetterNode(boolean useFile,boolean console,String dbOutput){
  JobMetterComponent statsComponent=new JobMetterComponent(useFile,console,dbOutput);
  DataNode statsNode=new DataNode(statsComponent,METER_UNIQUE_NAME);
  statsNode.setStart(true);
  statsNode.setSubProcessStart(true);
  statsNode.setActivate(true);
  statsNode.getMetadataList().clear();
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get("String_Node_Str",ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  boolean found=false;
  for (int k=0; k < tmpNode.getElementParameters().size() && !found; k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=((IMetadataTable)value).clone();
        table.setTableName(METER_UNIQUE_NAME);
        table.setAttachedConnector(currentParam.getContext());
        statsNode.getMetadataList().add(table);
      }
      found=true;
    }
  }
  return statsNode;
}

Fixed version (ground truth):
private static DataNode createMetterNode(boolean useFile,boolean console,String dbOutput){
  JobMetterComponent statsComponent=new JobMetterComponent(useFile,console,dbOutput);
  DataNode statsNode=new DataNode(statsComponent,METER_UNIQUE_NAME);
  statsNode.setStart(true);
  statsNode.setSubProcessStart(true);
  statsNode.setActivate(true);
  statsNode.getMetadataList().clear();
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get("String_Node_Str",ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  boolean found=false;
  for (int k=0; k < tmpNode.getElementParameters().size() && !found; k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=((IMetadataTable)value).clone();
        table.setTableName(METER_UNIQUE_NAME);
        table.setAttachedConnector(currentParam.getContext());
        statsNode.getMetadataList().add(table);
      }
      found=true;
    }
  }
  return statsNode;
}
Program: 118616
Project: 118616
Buggy source:
private static DataNode createStatsNode(boolean useFile,boolean console,String dbOutput){
  JobStatsComponent statsComponent=new JobStatsComponent(useFile,console,dbOutput);
  DataNode statsNode=new DataNode(statsComponent,STAT_UNIQUE_NAME);
  statsNode.setStart(true);
  statsNode.setSubProcessStart(true);
  statsNode.setActivate(true);
  statsNode.getMetadataList().clear();
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get("String_Node_Str",ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  boolean found=false;
  for (int k=0; k < tmpNode.getElementParameters().size() && !found; k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=((IMetadataTable)value).clone();
        table.setTableName(STAT_UNIQUE_NAME);
        table.setAttachedConnector(currentParam.getContext());
        statsNode.getMetadataList().add(table);
      }
      found=true;
    }
  }
  return statsNode;
}

Fixed version (ground truth):
private static DataNode createStatsNode(boolean useFile,boolean console,String dbOutput){
  JobStatsComponent statsComponent=new JobStatsComponent(useFile,console,dbOutput);
  DataNode statsNode=new DataNode(statsComponent,STAT_UNIQUE_NAME);
  statsNode.setStart(true);
  statsNode.setSubProcessStart(true);
  statsNode.setActivate(true);
  statsNode.getMetadataList().clear();
  IComponent tmpComponent=ComponentsFactoryProvider.getInstance().get("String_Node_Str",ComponentCategory.CATEGORY_4_DI.getName());
  DataNode tmpNode=new DataNode(tmpComponent,"String_Node_Str");
  boolean found=false;
  for (int k=0; k < tmpNode.getElementParameters().size() && !found; k++) {
    IElementParameter currentParam=tmpNode.getElementParameters().get(k);
    if (currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || currentParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
      Object value=currentParam.getValue();
      if (value instanceof IMetadataTable) {
        IMetadataTable table=((IMetadataTable)value).clone();
        table.setTableName(STAT_UNIQUE_NAME);
        table.setAttachedConnector(currentParam.getContext());
        statsNode.getMetadataList().add(table);
      }
      found=true;
    }
  }
  return statsNode;
}
Program: 118622
Project: 118622
Buggy source:
@Override protected boolean isReadOnly(){
  return true;
}

Fixed version (ground truth):
@Override protected boolean isReadOnly(){
  return !isInWizard();
}
Program: 118623
Project: 118623
Buggy source:
@Override public Control createControl(Composite subComposite,IElementParameter param,int numInRow,int nbInRow,int top,Control lastControl){
  Control lastControlUsed=super.createControl(subComposite,param,numInRow,nbInRow,top,lastControl);
  FormData data=(FormData)lastControlUsed.getLayoutData();
  if (!param.isRepositoryValueUsed()) {
    data.right=new FormAttachment((numInRow * MAX_PERCENT) / nbInRow,-STANDARD_BUTTON_WIDTH);
    lastControlUsed=addButton(subComposite,param,lastControlUsed,numInRow,nbInRow,top);
  }
  return lastControlUsed;
}

Fixed version (ground truth):
@Override public Control createControl(Composite subComposite,IElementParameter param,int numInRow,int nbInRow,int top,Control lastControl){
  Control lastControlUsed=super.createControl(subComposite,param,numInRow,nbInRow,top,lastControl);
  if (labelText != null) {
    labelText.setEchoChar('*');
  }
  FormData data=(FormData)lastControlUsed.getLayoutData();
  if (!param.isRepositoryValueUsed() && !isInWizard()) {
    data.right=new FormAttachment((numInRow * MAX_PERCENT) / nbInRow,-STANDARD_BUTTON_WIDTH);
    lastControlUsed=addButton(subComposite,param,lastControlUsed,numInRow,nbInRow,top);
  }
  return lastControlUsed;
}
Program: 118624
Project: 118624
Buggy source:
private void updateProperty(Object newValue){
  if (componentProperties == null) {
    return;
  }
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property se=(Property)widgetProperty;
    Object oldValue=se.getValue();
    if (newValue != null && !newValue.equals(oldValue)) {
      se=(Property)componentProperties.getProperty(se.getName());
      if (isDrivedByForm()) {
        form.setValue(se.getName(),newValue);
      }
 else {
        if (newValue instanceof List) {
          setTableValues(se,(List<Map<String,Object>>)newValue);
        }
 else {
          se.setValue(newValue);
        }
      }
      fireConnectionPropertyChangedEvent(newValue);
    }
  }
 else   if (widgetProperty instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)widgetProperty;
    Form formtoShow=pi.getFormtoShow();
    if (formtoShow != null) {
      fireShowDialogEvent(componentProperties.getForm(formtoShow.getName()));
    }
  }
}

Fixed version (ground truth):
private void updateProperty(Object newValue){
  if (componentProperties == null) {
    return;
  }
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property se=(Property)widgetProperty;
    Object oldValue=se.getValue();
    if (newValue != null && !newValue.equals(oldValue)) {
      se=(Property)componentProperties.getProperty(se.getName());
      if (isDrivedByForm()) {
        form.setValue(se.getName(),newValue);
      }
 else {
        if (newValue instanceof List && WidgetType.TABLE.equals(widget.getWidgetType())) {
          setTableValues(se,(List<Map<String,Object>>)newValue);
        }
 else {
          se.setValue(newValue);
        }
      }
      fireConnectionPropertyChangedEvent(newValue);
    }
  }
 else   if (widgetProperty instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)widgetProperty;
    Form formtoShow=pi.getFormtoShow();
    if (formtoShow != null) {
      fireShowDialogEvent(componentProperties.getForm(formtoShow.getName()));
    }
  }
}
Program: 118625
Project: 118625
Buggy source:
private void updateProperty(Object newValue){
  if (componentProperties == null) {
    return;
  }
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property se=(Property)widgetProperty;
    Object oldValue=se.getValue();
    if (newValue != null && !newValue.equals(oldValue)) {
      se=(Property)componentProperties.getProperty(se.getName());
      if (isDrivedByForm()) {
        form.setValue(se.getName(),newValue);
      }
 else {
        if (newValue instanceof List) {
          setTableValues(se,(List<Map<String,Object>>)newValue);
        }
 else {
          se.setValue(newValue);
        }
      }
      fireConnectionPropertyChangedEvent(newValue);
    }
  }
 else   if (widgetProperty instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)widgetProperty;
    Form formtoShow=pi.getFormtoShow();
    if (formtoShow != null) {
      fireShowDialogEvent(componentProperties.getForm(formtoShow.getName()));
    }
  }
}

Fixed version (ground truth):
private void updateProperty(Object newValue){
  if (componentProperties == null) {
    return;
  }
  NamedThing widgetProperty=widget.getContent();
  if (widgetProperty instanceof Property) {
    Property se=(Property)widgetProperty;
    Object oldValue=se.getValue();
    if (newValue != null && !newValue.equals(oldValue)) {
      se=(Property)componentProperties.getProperty(se.getName());
      if (isDrivedByForm()) {
        form.setValue(se.getName(),newValue);
      }
 else {
        if (newValue instanceof List && WidgetType.TABLE.equals(widget.getWidgetType())) {
          setTableValues(se,(List<Map<String,Object>>)newValue);
        }
 else {
          se.setValue(newValue);
        }
      }
      fireConnectionPropertyChangedEvent(newValue);
    }
  }
 else   if (widgetProperty instanceof PresentationItem) {
    PresentationItem pi=(PresentationItem)widgetProperty;
    Form formtoShow=pi.getFormtoShow();
    if (formtoShow != null) {
      fireShowDialogEvent(componentProperties.getForm(formtoShow.getName()));
    }
  }
}
Program: 118629
Project: 118629
Buggy source:
public boolean useSchema(){
  return false;
}

Fixed version (ground truth):
public boolean useSchema(Node node){
  return false;
}
Program: 118630
Project: 118630
Buggy source:
@Override public boolean useSchema(){
  boolean useSchema=false;
  if (compType == null) {
    isLoaded=false;
    try {
      load();
    }
 catch (    BusinessException e) {
      ExceptionHandler.process(e);
    }
  }
  PARAMETERType pType;
  EList parameters=compType.getPARAMETERS().getPARAMETER();
  for (  Object parameter : parameters) {
    pType=(PARAMETERType)parameter;
    if ("String_Node_Str".equals(pType.getFIELD()) && !pType.isREADONLY() && (pType.getCONTEXT() == null || "String_Node_Str".equals(pType.getCONTEXT()))) {
      useSchema=true;
      break;
    }
  }
  return useSchema;
}

Fixed version (ground truth):
@Override public boolean useSchema(Node node){
  boolean useSchema=false;
  if (compType == null) {
    isLoaded=false;
    try {
      load();
    }
 catch (    BusinessException e) {
      ExceptionHandler.process(e);
    }
  }
  PARAMETERType pType;
  EList parameters=compType.getPARAMETERS().getPARAMETER();
  for (  Object parameter : parameters) {
    pType=(PARAMETERType)parameter;
    if ("String_Node_Str".equals(pType.getFIELD()) && !pType.isREADONLY() && (pType.getCONTEXT() == null || "String_Node_Str".equals(pType.getCONTEXT()))) {
      useSchema=true;
      break;
    }
  }
  return useSchema;
}
Program: 118631
Project: 118631
Buggy source:
/** 
 * DOC ycbai Comment method "isSupportValidationRuleNode".
 * @param node
 * @return
 */
private boolean isSupportValidationRuleNode(Node node){
  boolean hasFlow=false;
  if (node.getComponent() != null && node.getComponent() instanceof EmfComponent) {
    EmfComponent component=(EmfComponent)node.getComponent();
    if (component.useLookup() || component.useMerge() || !component.useSchema()) {
      return false;
    }
    if (component.useFlow()) {
      hasFlow=true;
    }
  }
  return hasFlow;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "isSupportValidationRuleNode".
 * @param node
 * @return
 */
private boolean isSupportValidationRuleNode(Node node){
  boolean hasFlow=false;
  if (node.getComponent() != null && node.getComponent() instanceof AbstractBasicComponent) {
    AbstractBasicComponent component=(AbstractBasicComponent)node.getComponent();
    if (component.useLookup() || component.useMerge() || !component.useSchema(node)) {
      return false;
    }
    if (component.useFlow()) {
      hasFlow=true;
    }
  }
  return hasFlow;
}
Program: 118633
Project: 118633
Buggy source:
private static void convertComponentSchemaIntoTalendSchema(Schema schema,MetadataTable metadataTable){
  for (  Schema.Field field : schema.getFields()) {
    MetadataColumn metadataColumn=MetadataToolAvroHelper.convertFromAvro(field);
    metadataTable.getColumns().add(metadataColumn);
  }
}

Fixed version (ground truth):
private static void convertComponentSchemaIntoTalendSchema(Schema schema,MetadataTable metadataTable){
  if (schema == null || metadataTable == null) {
    return;
  }
  for (  Schema.Field field : schema.getFields()) {
    MetadataColumn metadataColumn=MetadataToolAvroHelper.convertFromAvro(field);
    metadataTable.getColumns().add(metadataColumn);
  }
}
Program: 118634
Project: 118634
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: 118639
Project: 118639
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(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;
}

Fixed version (ground truth):
public static MetadataTable createSchema(String name,ComponentProperties properties,String schemaPropertyName){
  if (name == null || properties == null || schemaPropertyName == null) {
    return null;
  }
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  MetadataTable metadataTable=ConnectionFactory.eINSTANCE.createMetadataTable();
  metadataTable.setId(factory.getNextId());
  metadataTable.setName(name);
  metadataTable.setLabel(name);
  metadataTable.setSourceName(name);
  Object schemaObj=ComponentsUtils.getGenericPropertyValue(properties,schemaPropertyName);
  if (schemaObj instanceof String) {
    Schema avroSchema=new Schema.Parser().parse((String)schemaObj);
    convertComponentSchemaIntoTalendSchema(avroSchema,metadataTable);
  }
  IMetadataTable iMetadataTable=MetadataToolHelper.convert(metadataTable);
  updateComponentSchema(properties,schemaPropertyName,iMetadataTable);
  metadataTable=ConvertionHelper.convert(iMetadataTable);
  properties.setValue(schemaPropertyName,convertTalendSchemaIntoComponentSchema(metadataTable));
  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);
  return metadataTable;
}
Program: 118640
Project: 118640
Buggy source:
private static void convertComponentSchemaIntoTalendSchema(Schema schema,MetadataTable metadataTable){
  for (  Schema.Field field : schema.getFields()) {
    MetadataColumn metadataColumn=MetadataToolAvroHelper.convertFromAvro(field);
    metadataTable.getColumns().add(metadataColumn);
  }
}

Fixed version (ground truth):
private static void convertComponentSchemaIntoTalendSchema(Schema schema,MetadataTable metadataTable){
  if (schema == null || metadataTable == null) {
    return;
  }
  for (  Schema.Field field : schema.getFields()) {
    MetadataColumn metadataColumn=MetadataToolAvroHelper.convertFromAvro(field);
    metadataTable.getColumns().add(metadataColumn);
  }
}