Program: 117885
Project: 117885
Buggy source:
@Override public ExecutionResult execute(final Item item){
  final ProcessType processType=getProcessType(item);
  ComponentCategory category=ComponentCategory.getComponentCategoryFromItem(item);
  Properties props=getPropertiesFromFile();
  IComponentConversion conversion=new IComponentConversion(){
    @Override public void transform(    NodeType nodeType){
      if (nodeType == null || props == null) {
        return;
      }
      boolean modified=false;
      Map<String,String> schemaParamMap=new HashMap<>();
      String currComponentName=nodeType.getComponentName();
      String newComponentName=props.getProperty(currComponentName);
      nodeType.setComponentName(newComponentName);
      String label=ParameterUtilTool.getParameterValue(nodeType,"String_Node_Str");
      if (label != null) {
        ElementParameterType paraType=ParameterUtilTool.findParameterType(nodeType,label.replaceAll("String_Node_Str","String_Node_Str"));
        if (paraType != null) {
          ParameterUtilTool.findParameterType(nodeType,"String_Node_Str").setValue(paraType.getValue());
          modified=true;
        }
      }
      IComponent component=ComponentsFactoryProvider.getInstance().get(newComponentName,category.getName());
      ComponentProperties compProperties=ComponentsUtils.getComponentProperties(newComponentName);
      FakeNode fNode=new FakeNode(component);
      for (      IElementParameter param : fNode.getElementParameters()) {
        if (param instanceof GenericElementParameter) {
          String paramName=param.getName();
          NamedThing currNamedThing=ComponentsUtils.getGenericSchemaElement(compProperties,paramName);
          String oldParamName=props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName);
          if (oldParamName != null && !(oldParamName=oldParamName.trim()).isEmpty()) {
            if (currNamedThing instanceof Property && (GenericTypeUtils.isSchemaType((Property<?>)currNamedThing))) {
              schemaParamMap.put(paramName,props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName+ IGenericConstants.EXP_SEPARATOR+ "String_Node_Str"));
            }
            ElementParameterType paramType=getParameterType(nodeType,oldParamName);
            if (paramType != null) {
              if (currNamedThing instanceof ComponentReferenceProperties) {
                ComponentReferenceProperties refProps=(ComponentReferenceProperties)currNamedThing;
                refProps.referenceType.setValue(ComponentReferenceProperties.ReferenceType.COMPONENT_INSTANCE);
                refProps.componentInstanceId.setStoredValue(ParameterUtilTool.convertParameterValue(paramType));
                refProps.componentInstanceId.setTaggedValue(IGenericConstants.ADD_QUOTES,true);
              }
 else {
                processMappedElementParameter(props,nodeType,(GenericElementParameter)param,paramType,currNamedThing);
              }
              ParameterUtilTool.removeParameterType(nodeType,paramType);
              modified=true;
            }
            if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType())) {
              String schemaTypeName="String_Node_Str" + EParameterName.SCHEMA_TYPE.getName();
              String repSchemaTypeName="String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName();
              paramType=getParameterType(nodeType,oldParamName + schemaTypeName);
              if (paramType != null) {
                paramType.setName(param.getName() + schemaTypeName);
              }
              paramType=getParameterType(nodeType,oldParamName + repSchemaTypeName);
              if (paramType != null) {
                paramType.setName(param.getName() + repSchemaTypeName);
              }
            }
          }
 else {
            processUnmappedElementParameter(props,nodeType,(GenericElementParameter)param,currNamedThing);
          }
        }
 else {
          if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType())) {
            String paramName=param.getName();
            schemaParamMap.put(paramName,props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName+ IGenericConstants.EXP_SEPARATOR+ "String_Node_Str"));
            String oldParamName=props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName);
            String schemaTypeName="String_Node_Str" + EParameterName.SCHEMA_TYPE.getName();
            String repSchemaTypeName="String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName();
            ElementParameterType paramType=getParameterType(nodeType,oldParamName + schemaTypeName);
            if (paramType != null) {
              paramType.setName(param.getName() + schemaTypeName);
            }
            paramType=getParameterType(nodeType,oldParamName + repSchemaTypeName);
            if (paramType != null) {
              paramType.setName(param.getName() + repSchemaTypeName);
            }
          }
        }
      }
      Map<String,MetadataType> metadatasMap=new HashMap<>();
      EList<MetadataType> metadatas=nodeType.getMetadata();
      for (      MetadataType metadataType : metadatas) {
        metadatasMap.put(metadataType.getConnector(),metadataType);
      }
      Iterator<Entry<String,String>> schemaParamIter=schemaParamMap.entrySet().iterator();
      String uniqueName=ParameterUtilTool.getParameterValue(nodeType,"String_Node_Str");
      while (schemaParamIter.hasNext()) {
        Entry<String,String> schemaParamEntry=schemaParamIter.next();
        String newParamName=schemaParamEntry.getKey();
        String connectorMapping=schemaParamEntry.getValue();
        String oldConnector=connectorMapping.split("String_Node_Str")[0];
        String newConnector=connectorMapping.split("String_Node_Str")[1];
        MetadataType metadataType=metadatasMap.get(oldConnector);
        if (metadataType != null) {
          metadataType.setConnector(newConnector);
          MetadataEmfFactory factory=new MetadataEmfFactory();
          factory.setMetadataType(metadataType);
          IMetadataTable metadataTable=factory.getMetadataTable();
          Schema schema=SchemaUtils.convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
          compProperties.setValue(newParamName,schema);
        }
        if (!oldConnector.equals(newConnector)) {
          for (          Object connectionObj : processType.getConnection()) {
            if (connectionObj instanceof ConnectionType) {
              ConnectionType connectionType=(ConnectionType)connectionObj;
              if (connectionType.getSource().equals(uniqueName) && connectionType.getConnectorName().equals(oldConnector)) {
                connectionType.setConnectorName(newConnector);
              }
            }
          }
        }
      }
      for (      Object connectionObj : processType.getConnection()) {
        ConnectionType connection=(ConnectionType)connectionObj;
        if (connection.getSource() != null && connection.getSource().equals(uniqueName)) {
          if (EConnectionType.FLOW_MAIN.getName().equals(connection.getConnectorName())) {
            connection.setConnectorName(Connector.MAIN_NAME);
          }
        }
      }
      if (modified) {
        String serializedProperties=compProperties.toSerialized();
        if (serializedProperties != null) {
          ElementParameterType pType=ParameterUtilTool.createParameterType(null,"String_Node_Str",serializedProperties);
          nodeType.getElementParameter().add(pType);
        }
      }
    }
  }
;
  if (processType != null) {
    boolean modified=false;
    for (    Object obj : processType.getNode()) {
      if (obj != null && obj instanceof NodeType) {
        String componentName=((NodeType)obj).getComponentName();
        String newComponentName=props.getProperty(componentName);
        if (newComponentName == null) {
          continue;
        }
        IComponentFilter filter=new NameComponentFilter(componentName);
        modified=ModifyComponentsAction.searchAndModify((NodeType)obj,filter,Arrays.<IComponentConversion>asList(conversion)) || modified;
      }
    }
    if (modified) {
      try {
        ProxyRepositoryFactory.getInstance().save(item,true);
        return ExecutionResult.SUCCESS_NO_ALERT;
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
      }
    }
  }
  return ExecutionResult.NOTHING_TO_DO;
}

Fixed version (ground truth):
@Override public ExecutionResult execute(final Item item){
  final ProcessType processType=getProcessType(item);
  ComponentCategory category=ComponentCategory.getComponentCategoryFromItem(item);
  Properties props=getPropertiesFromFile();
  IComponentConversion conversion=new IComponentConversion(){
    @Override public void transform(    NodeType nodeType){
      if (nodeType == null || props == null) {
        return;
      }
      boolean modified=false;
      Map<String,String> schemaParamMap=new HashMap<>();
      String currComponentName=nodeType.getComponentName();
      String newComponentName=props.getProperty(currComponentName);
      nodeType.setComponentName(newComponentName);
      String label=ParameterUtilTool.getParameterValue(nodeType,"String_Node_Str");
      if (label != null) {
        ElementParameterType paraType=ParameterUtilTool.findParameterType(nodeType,label.replaceAll("String_Node_Str","String_Node_Str"));
        if (paraType != null) {
          ParameterUtilTool.findParameterType(nodeType,"String_Node_Str").setValue(paraType.getValue());
          modified=true;
        }
      }
      IComponent component=ComponentsFactoryProvider.getInstance().get(newComponentName,category.getName());
      ComponentProperties compProperties=ComponentsUtils.getComponentProperties(newComponentName);
      FakeNode fNode=new FakeNode(component);
      ElementParameterType propertyParamType=getParameterType(nodeType,"String_Node_Str");
      boolean isRepository=false;
      if (propertyParamType != null && "String_Node_Str".equals(propertyParamType.getValue())) {
        isRepository=true;
      }
      ElementParameterType sqlParamType=getParameterType(nodeType,"String_Node_Str");
      boolean isSQLRepository=false;
      if (sqlParamType != null && "String_Node_Str".equals(propertyParamType.getValue())) {
        isSQLRepository=true;
      }
      for (      IElementParameter param : fNode.getElementParameters()) {
        if (param instanceof GenericElementParameter) {
          String paramName=param.getName();
          NamedThing currNamedThing=ComponentsUtils.getGenericSchemaElement(compProperties,paramName);
          String oldParamName=props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName);
          if (oldParamName != null && !(oldParamName=oldParamName.trim()).isEmpty()) {
            if (currNamedThing instanceof Property && (GenericTypeUtils.isSchemaType((Property<?>)currNamedThing))) {
              schemaParamMap.put(paramName,props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName+ IGenericConstants.EXP_SEPARATOR+ "String_Node_Str"));
            }
            ElementParameterType paramType=getParameterType(nodeType,oldParamName);
            if (paramType != null) {
              if (currNamedThing instanceof ComponentReferenceProperties) {
                ComponentReferenceProperties refProps=(ComponentReferenceProperties)currNamedThing;
                refProps.referenceType.setValue(ComponentReferenceProperties.ReferenceType.COMPONENT_INSTANCE);
                refProps.componentInstanceId.setStoredValue(ParameterUtilTool.convertParameterValue(paramType));
                refProps.componentInstanceId.setTaggedValue(IGenericConstants.ADD_QUOTES,true);
              }
 else {
                processMappedElementParameter(props,nodeType,(GenericElementParameter)param,paramType,currNamedThing);
              }
              ParameterUtilTool.removeParameterType(nodeType,paramType);
              modified=true;
            }
            if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType())) {
              String schemaTypeName="String_Node_Str" + EParameterName.SCHEMA_TYPE.getName();
              String repSchemaTypeName="String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName();
              paramType=getParameterType(nodeType,oldParamName + schemaTypeName);
              if (paramType != null) {
                paramType.setName(param.getName() + schemaTypeName);
              }
              paramType=getParameterType(nodeType,oldParamName + repSchemaTypeName);
              if (paramType != null) {
                paramType.setName(param.getName() + repSchemaTypeName);
              }
            }
          }
 else {
            processUnmappedElementParameter(props,nodeType,(GenericElementParameter)param,currNamedThing);
          }
          if (isRepository && isRepositoryParam(paramName) || isSQLRepository && "String_Node_Str".equals(paramName)) {
            ComponentsUtils.setPropertiesPepositoryValue(compProperties,paramName);
          }
        }
 else {
          if (EParameterFieldType.SCHEMA_REFERENCE.equals(param.getFieldType())) {
            String paramName=param.getName();
            schemaParamMap.put(paramName,props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName+ IGenericConstants.EXP_SEPARATOR+ "String_Node_Str"));
            String oldParamName=props.getProperty(currComponentName + IGenericConstants.EXP_SEPARATOR + paramName);
            String schemaTypeName="String_Node_Str" + EParameterName.SCHEMA_TYPE.getName();
            String repSchemaTypeName="String_Node_Str" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName();
            ElementParameterType paramType=getParameterType(nodeType,oldParamName + schemaTypeName);
            if (paramType != null) {
              paramType.setName(param.getName() + schemaTypeName);
            }
            paramType=getParameterType(nodeType,oldParamName + repSchemaTypeName);
            if (paramType != null) {
              paramType.setName(param.getName() + repSchemaTypeName);
            }
          }
        }
      }
      Map<String,MetadataType> metadatasMap=new HashMap<>();
      EList<MetadataType> metadatas=nodeType.getMetadata();
      for (      MetadataType metadataType : metadatas) {
        metadatasMap.put(metadataType.getConnector(),metadataType);
      }
      Iterator<Entry<String,String>> schemaParamIter=schemaParamMap.entrySet().iterator();
      String uniqueName=ParameterUtilTool.getParameterValue(nodeType,"String_Node_Str");
      while (schemaParamIter.hasNext()) {
        Entry<String,String> schemaParamEntry=schemaParamIter.next();
        String newParamName=schemaParamEntry.getKey();
        String connectorMapping=schemaParamEntry.getValue();
        String oldConnector=connectorMapping.split("String_Node_Str")[0];
        String newConnector=connectorMapping.split("String_Node_Str")[1];
        MetadataType metadataType=metadatasMap.get(oldConnector);
        if (metadataType != null) {
          metadataType.setConnector(newConnector);
          MetadataEmfFactory factory=new MetadataEmfFactory();
          factory.setMetadataType(metadataType);
          IMetadataTable metadataTable=factory.getMetadataTable();
          Schema schema=SchemaUtils.convertTalendSchemaIntoComponentSchema(ConvertionHelper.convert(metadataTable));
          compProperties.setValue(newParamName,schema);
        }
        if (!oldConnector.equals(newConnector)) {
          for (          Object connectionObj : processType.getConnection()) {
            if (connectionObj instanceof ConnectionType) {
              ConnectionType connectionType=(ConnectionType)connectionObj;
              if (connectionType.getSource().equals(uniqueName) && connectionType.getConnectorName().equals(oldConnector)) {
                connectionType.setConnectorName(newConnector);
              }
            }
          }
        }
      }
      for (      Object connectionObj : processType.getConnection()) {
        ConnectionType connection=(ConnectionType)connectionObj;
        if (connection.getSource() != null && connection.getSource().equals(uniqueName)) {
          if (EConnectionType.FLOW_MAIN.getName().equals(connection.getConnectorName())) {
            connection.setConnectorName(Connector.MAIN_NAME);
          }
        }
      }
      if (modified) {
        String serializedProperties=compProperties.toSerialized();
        if (serializedProperties != null) {
          ElementParameterType pType=ParameterUtilTool.createParameterType(null,"String_Node_Str",serializedProperties);
          nodeType.getElementParameter().add(pType);
        }
      }
    }
  }
;
  if (processType != null) {
    boolean modified=false;
    for (    Object obj : processType.getNode()) {
      if (obj != null && obj instanceof NodeType) {
        String componentName=((NodeType)obj).getComponentName();
        String newComponentName=props.getProperty(componentName);
        if (newComponentName == null) {
          continue;
        }
        IComponentFilter filter=new NameComponentFilter(componentName);
        modified=ModifyComponentsAction.searchAndModify((NodeType)obj,filter,Arrays.<IComponentConversion>asList(conversion)) || modified;
      }
    }
    if (modified) {
      try {
        ProxyRepositoryFactory.getInstance().save(item,true);
        return ExecutionResult.SUCCESS_NO_ALERT;
      }
 catch (      PersistenceException e) {
        ExceptionHandler.process(e);
        return ExecutionResult.FAILURE;
      }
    }
  }
  return ExecutionResult.NOTHING_TO_DO;
}