Program: 117914
Project: 117914
Buggy source:
private void init(IComponent newComponent){
  this.component=newComponent;
  this.label=component.getName();
  updateComponentStatusIfNeeded(true);
  IPreferenceStore store=DesignerPlugin.getDefault().getPreferenceStore();
  labelToParse=store.getString(TalendDesignerPrefConstants.DEFAULT_LABEL);
  hintToParse=store.getString(TalendDesignerPrefConstants.DEFAULT_HINT);
  connectionToParse=store.getString(TalendDesignerPrefConstants.DEFAULT_CONNECTION_FORMAT);
  showHint=store.getBoolean(TalendDesignerPrefConstants.DEFAULT_HINT_USED);
  if (nodeLabel == null) {
    nodeLabel=new NodeLabel(label,this);
  }
  if (nodeError == null) {
    nodeError=new NodeError(this);
  }
  if (nodeProgressBar == null) {
    nodeProgressBar=new NodeProgressBar(this);
  }
  listConnector=this.component.createConnectors(this);
  metadataList=new ArrayList<IMetadataTable>();
  String uniqueName2=null;
  IElementParameter unparam=getElementParameter(EParameterName.UNIQUE_NAME.getName());
  if (unparam != null && !"String_Node_Str".equals(unparam.getValue())) {
    uniqueName2=(String)unparam.getValue();
  }
  setElementParameters(component.createElementParameters(this));
  boolean hasSchemaType=false;
  for (  IElementParameter param : getElementParameters()) {
    if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.DCSCHEMA) || param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
      IMetadataTable table=getNewMetadataTable();
      table.setAttachedConnector(param.getContext());
      metadataList.add(table);
      hasSchemaType=true;
    }
  }
  boolean hasMetadata=false;
  for (  INodeConnector curConnector : getListConnector()) {
    if (curConnector.getDefaultConnectionType().hasConnectionCategory(IConnectionCategory.DATA)) {
      if (!curConnector.isMultiSchema() && (curConnector.getMaxLinkInput() != 0 || curConnector.getMaxLinkOutput() != 0)) {
        hasMetadata=true;
        break;
      }
    }
  }
  if (hasMetadata && !hasSchemaType) {
    String mainConnector;
    if (isELTComponent()) {
      mainConnector=EConnectionType.TABLE.getName();
    }
 else {
      mainConnector=EConnectionType.FLOW_MAIN.getName();
    }
    IMetadataTable table=getNewMetadataTable();
    table.setAttachedConnector(mainConnector);
    metadataList.add(table);
  }
  listReturn=this.component.createReturns();
  if (!reloadingComponent && (uniqueName2 == null || "String_Node_Str".equals(uniqueName2))) {
    if (this.inOutUniqueName != null) {
      uniqueName2=inOutUniqueName;
    }
 else {
      uniqueName2=((Process)getProcess()).generateUniqueNodeName(this);
    }
    ((Process)getProcess()).addUniqueNodeName(uniqueName2);
  }
  setPropertyValue(EParameterName.UNIQUE_NAME.getName(),uniqueName2);
  for (  IElementParameter param : getElementParameters()) {
    if (param.getValue() != null && param.getValue() instanceof String) {
      String value=(String)param.getValue();
      if (value.contains("String_Node_Str")) {
        value=value.replace("String_Node_Str",uniqueName2);
        param.setValue(value);
      }
    }
  }
  IElementParameter mappingParameter=MetadataToolHelper.getMappingParameter((List<IElementParameter>)this.getElementParameters());
  for (  IMetadataTable table : metadataList) {
    if (table.getAttachedConnector() != null && (table.getAttachedConnector().equals(EConnectionType.FLOW_MAIN.getName()) || table.getAttachedConnector().equals(EConnectionType.TABLE.getName()))) {
      table.setTableName(uniqueName2);
    }
 else {
      table.setTableName(table.getAttachedConnector());
    }
    if (mappingParameter != null) {
      if (mappingParameter.getValue() != null && (!mappingParameter.getValue().equals("String_Node_Str"))) {
        table.setDbms((String)mappingParameter.getValue());
      }
    }
    for (int i=0; i < getElementParameters().size(); i++) {
      IElementParameter param=getElementParameters().get(i);
      if (param.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
        table.setDbms((String)param.getValue());
      }
      if ((param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.DCSCHEMA) || param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) && param.getContext() != null && param.getContext().equals(table.getAttachedConnector())) {
        if (param.getValue() instanceof IMetadataTable) {
          IMetadataTable paramTable=(IMetadataTable)param.getValue();
          table.getListColumns().addAll(paramTable.getListColumns());
          table.setReadOnly(paramTable.isReadOnly());
        }
 else         if (param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
          Schema schema=(Schema)componentProperties.getValuedProperty(param.getName()).getValue();
          org.talend.core.model.metadata.builder.connection.MetadataTable defaultEmfTable=MetadataToolAvroHelper.convertFromAvro(schema);
          IMetadataTable defaultTable=MetadataToolHelper.convert(defaultEmfTable);
          IMetadataTable myTable=getMetadataFromConnector(param.getContext());
          myTable.getListColumns().addAll(defaultTable.getListColumns());
          myTable.setReadOnly(defaultTable.isReadOnly());
        }
      }
    }
  }
  for (int i=0; i < getElementParameters().size(); i++) {
    IElementParameter param=getElementParameters().get(i);
    Object obj=param.getValue();
    if (obj != null) {
      if (param.getName().equals(EParameterName.LABEL.getName())) {
        labelToParse=(String)obj;
      }
 else       if (param.getName().equals(EParameterName.HINT.getName())) {
        hintToParse=(String)obj;
      }
 else       if (param.getName().equals(EParameterName.CONNECTION_FORMAT.getName())) {
        connectionToParse=(String)obj;
      }
 else       if (param.getName().equals(EParameterName.VALIDATION_RULES.getName())) {
        hasValidationRule=(Boolean)obj;
      }
    }
  }
  if (!reloadingComponent) {
    setPropertyValue(EParameterName.LABEL.getName(),labelToParse);
    setPropertyValue(EParameterName.HINT.getName(),hintToParse);
    setPropertyValue(EParameterName.CONNECTION_FORMAT.getName(),connectionToParse);
    connectionName=ElementParameterParser.parse(this,connectionToParse);
    setPropertyValue(EParameterName.SHOW_HINT.getName(),new Boolean(showHint));
    setPropertyValue(EParameterName.VALIDATION_RULES.getName(),hasValidationRule);
  }
  setHasValidationRule(hasValidationRule);
  if (component.getPluginExtension() != null) {
    externalNode=ExternalNodesFactory.getInstance(component.getPluginExtension());
  }
  if (isExternalNode()) {
    IExternalNode eternalNode=getExternalNode();
    eternalNode.initialize();
  }
  if (!getProcess().isDuplicate() || CommonsPlugin.isHeadless() || this.process.getEditor() == null) {
    calculateSubtreeStartAndEnd();
  }
  updateComponentStatusIfNeeded(false);
}

Fixed version (ground truth):
private void init(IComponent newComponent){
  this.component=newComponent;
  this.label=component.getName();
  updateComponentStatusIfNeeded(true);
  IPreferenceStore store=DesignerPlugin.getDefault().getPreferenceStore();
  labelToParse=store.getString(TalendDesignerPrefConstants.DEFAULT_LABEL);
  hintToParse=store.getString(TalendDesignerPrefConstants.DEFAULT_HINT);
  connectionToParse=store.getString(TalendDesignerPrefConstants.DEFAULT_CONNECTION_FORMAT);
  showHint=store.getBoolean(TalendDesignerPrefConstants.DEFAULT_HINT_USED);
  if (nodeLabel == null) {
    nodeLabel=new NodeLabel(label,this);
  }
  if (nodeError == null) {
    nodeError=new NodeError(this);
  }
  if (nodeProgressBar == null) {
    nodeProgressBar=new NodeProgressBar(this);
  }
  listConnector=this.component.createConnectors(this);
  metadataList=new ArrayList<IMetadataTable>();
  String uniqueName2=null;
  IElementParameter unparam=getElementParameter(EParameterName.UNIQUE_NAME.getName());
  if (unparam != null && !"String_Node_Str".equals(unparam.getValue())) {
    uniqueName2=(String)unparam.getValue();
  }
  setElementParameters(component.createElementParameters(this));
  boolean hasSchemaType=false;
  for (  IElementParameter param : getElementParameters()) {
    if (param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.DCSCHEMA) || param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
      IMetadataTable table=getNewMetadataTable();
      table.setAttachedConnector(param.getContext());
      metadataList.add(table);
      hasSchemaType=true;
    }
  }
  boolean hasMetadata=false;
  for (  INodeConnector curConnector : getListConnector()) {
    if (curConnector.getDefaultConnectionType().hasConnectionCategory(IConnectionCategory.DATA)) {
      if (!curConnector.isMultiSchema() && (curConnector.getMaxLinkInput() != 0 || curConnector.getMaxLinkOutput() != 0)) {
        hasMetadata=true;
        break;
      }
    }
  }
  if (hasMetadata && !hasSchemaType) {
    String mainConnector;
    if (isELTComponent()) {
      mainConnector=EConnectionType.TABLE.getName();
    }
 else {
      mainConnector=EConnectionType.FLOW_MAIN.getName();
    }
    IMetadataTable table=getNewMetadataTable();
    table.setAttachedConnector(mainConnector);
    metadataList.add(table);
  }
  listReturn=this.component.createReturns(this);
  if (!reloadingComponent && (uniqueName2 == null || "String_Node_Str".equals(uniqueName2))) {
    if (this.inOutUniqueName != null) {
      uniqueName2=inOutUniqueName;
    }
 else {
      uniqueName2=((Process)getProcess()).generateUniqueNodeName(this);
    }
    ((Process)getProcess()).addUniqueNodeName(uniqueName2);
  }
  setPropertyValue(EParameterName.UNIQUE_NAME.getName(),uniqueName2);
  for (  IElementParameter param : getElementParameters()) {
    if (param.getValue() != null && param.getValue() instanceof String) {
      String value=(String)param.getValue();
      if (value.contains("String_Node_Str")) {
        value=value.replace("String_Node_Str",uniqueName2);
        param.setValue(value);
      }
    }
  }
  IElementParameter mappingParameter=MetadataToolHelper.getMappingParameter((List<IElementParameter>)this.getElementParameters());
  for (  IMetadataTable table : metadataList) {
    if (table.getAttachedConnector() != null && (table.getAttachedConnector().equals(EConnectionType.FLOW_MAIN.getName()) || table.getAttachedConnector().equals(EConnectionType.TABLE.getName()))) {
      table.setTableName(uniqueName2);
    }
 else {
      table.setTableName(table.getAttachedConnector());
    }
    if (mappingParameter != null) {
      if (mappingParameter.getValue() != null && (!mappingParameter.getValue().equals("String_Node_Str"))) {
        table.setDbms((String)mappingParameter.getValue());
      }
    }
    for (int i=0; i < getElementParameters().size(); i++) {
      IElementParameter param=getElementParameters().get(i);
      if (param.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
        table.setDbms((String)param.getValue());
      }
      if ((param.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || param.getFieldType().equals(EParameterFieldType.DCSCHEMA) || param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) && param.getContext() != null && param.getContext().equals(table.getAttachedConnector())) {
        if (param.getValue() instanceof IMetadataTable) {
          IMetadataTable paramTable=(IMetadataTable)param.getValue();
          table.getListColumns().addAll(paramTable.getListColumns());
          table.setReadOnly(paramTable.isReadOnly());
        }
 else         if (param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
          Schema schema=(Schema)componentProperties.getValuedProperty(param.getName()).getValue();
          org.talend.core.model.metadata.builder.connection.MetadataTable defaultEmfTable=MetadataToolAvroHelper.convertFromAvro(schema);
          IMetadataTable defaultTable=MetadataToolHelper.convert(defaultEmfTable);
          IMetadataTable myTable=getMetadataFromConnector(param.getContext());
          myTable.getListColumns().addAll(defaultTable.getListColumns());
          myTable.setReadOnly(defaultTable.isReadOnly());
        }
      }
    }
  }
  for (int i=0; i < getElementParameters().size(); i++) {
    IElementParameter param=getElementParameters().get(i);
    Object obj=param.getValue();
    if (obj != null) {
      if (param.getName().equals(EParameterName.LABEL.getName())) {
        labelToParse=(String)obj;
      }
 else       if (param.getName().equals(EParameterName.HINT.getName())) {
        hintToParse=(String)obj;
      }
 else       if (param.getName().equals(EParameterName.CONNECTION_FORMAT.getName())) {
        connectionToParse=(String)obj;
      }
 else       if (param.getName().equals(EParameterName.VALIDATION_RULES.getName())) {
        hasValidationRule=(Boolean)obj;
      }
    }
  }
  if (!reloadingComponent) {
    setPropertyValue(EParameterName.LABEL.getName(),labelToParse);
    setPropertyValue(EParameterName.HINT.getName(),hintToParse);
    setPropertyValue(EParameterName.CONNECTION_FORMAT.getName(),connectionToParse);
    connectionName=ElementParameterParser.parse(this,connectionToParse);
    setPropertyValue(EParameterName.SHOW_HINT.getName(),new Boolean(showHint));
    setPropertyValue(EParameterName.VALIDATION_RULES.getName(),hasValidationRule);
  }
  setHasValidationRule(hasValidationRule);
  if (component.getPluginExtension() != null) {
    externalNode=ExternalNodesFactory.getInstance(component.getPluginExtension());
  }
  if (isExternalNode()) {
    IExternalNode eternalNode=getExternalNode();
    eternalNode.initialize();
  }
  if (!getProcess().isDuplicate() || CommonsPlugin.isHeadless() || this.process.getEditor() == null) {
    calculateSubtreeStartAndEnd();
  }
  updateComponentStatusIfNeeded(false);
}