Program: 118632
Project: 118632
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);
  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;
}

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;
}