Program: 121550
Project: 121550
Buggy source:
private void init(IComponent newComponent){
  this.component=newComponent;
  this.label=component.getName();
  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>();
  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;
      }
    }
  }
  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)) {
      IMetadataTable table=new MetadataTable();
      table.setAttachedConnector(param.getContext());
      metadataList.add(table);
      hasSchemaType=true;
    }
  }
  if (hasMetadata && !hasSchemaType) {
    String mainConnector;
    if (isELTComponent()) {
      mainConnector=EConnectionType.TABLE.getName();
    }
 else {
      mainConnector=EConnectionType.FLOW_MAIN.getName();
    }
    IMetadataTable table=new MetadataTable();
    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);
  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.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());
        }
      }
    }
  }
  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);
    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();
  }
  size=new Dimension();
  if (getIcon32() != null) {
    size.height=getIcon32().getImageData().height;
    size.width=getIcon32().getImageData().width;
  }
 else {
    size.height=DEFAULT_SIZE;
    size.width=DEFAULT_SIZE;
  }
  if (!getProcess().isDuplicate()) {
    calculateSubtreeStart();
  }
}

Fixed version (ground truth):
private void init(IComponent newComponent){
  this.component=newComponent;
  this.label=component.getName();
  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>();
  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;
      }
    }
  }
  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)) {
      IMetadataTable table=new MetadataTable();
      table.setAttachedConnector(param.getContext());
      metadataList.add(table);
      hasSchemaType=true;
    }
  }
  if (hasMetadata && !hasSchemaType) {
    String mainConnector;
    if (isELTComponent()) {
      mainConnector=EConnectionType.TABLE.getName();
    }
 else {
      mainConnector=EConnectionType.FLOW_MAIN.getName();
    }
    IMetadataTable table=new MetadataTable();
    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);
  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.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());
        }
      }
    }
  }
  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);
    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();
  }
  size=new Dimension();
  if (getIcon32() != null) {
    size.height=getIcon32().getImageData().height;
    size.width=getIcon32().getImageData().width;
  }
 else {
    size.height=DEFAULT_SIZE;
    size.width=DEFAULT_SIZE;
  }
  if (!getProcess().isDuplicate()) {
    calculateSubtreeStartAndEnd();
  }
}