Program: 118758
Project: 118758
Buggy source:
private void propagateDatas(boolean isExecute){
  if (schemaParam != null && schemaParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) && EConnectionType.FLOW_MAIN.getDefaultMenuName().toUpperCase().equals(schemaParam.getContext())) {
    currentConnector=EConnectionType.FLOW_MAIN.getName();
  }
  String baseConnectorForCurrentNode=node.getConnectorFromName(currentConnector).getBaseSchema();
  if (outputdataContainer != null && (!outputdataContainer.getInputs().isEmpty() || !outputdataContainer.getOuputs().isEmpty())) {
    for (    IODataComponent currentIO : outputdataContainer.getInputs()) {
      INode sourceNode=currentIO.getSource();
      if (currentIO.hasChanged() && (sourceNode.getConnectorFromName(currentIO.getConnection().getConnectorName()).getBaseSchema().equals(baseConnectorForCurrentNode))) {
        sourceNode.metadataOutputChanged(currentIO,currentIO.getName());
        if (isExecute) {
          currentIO.setTable(oldInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
 else {
          currentIO.setTable(newInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
      }
    }
    for (    IODataComponent currentIO : outputdataContainer.getOuputs()) {
      INodeConnector nodeConnector=null;
      String baseConnector=null;
      Node sourceNode=(Node)currentIO.getSource();
      nodeConnector=sourceNode.getConnectorFromName(currentIO.getConnection().getConnectorName());
      baseConnector=nodeConnector.getBaseSchema();
      INode targetNode=currentIO.getTarget();
      boolean sourceIsBuiltIn=((Node)currentIO.getSource()).getConnectorFromType(currentIO.getConnection().getLineStyle()).isMultiSchema();
      boolean targetIsBuiltIn=((Node)targetNode).getConnectorFromType(currentIO.getConnection().getLineStyle()).isMultiSchema();
      boolean isJoblet=((Node)targetNode).isJoblet();
      if (!isJoblet && baseConnector.equals(baseConnectorForCurrentNode) && (targetIsBuiltIn || (targetNode.getMetadataFromConnector(baseConnector) != null && !targetNode.getMetadataFromConnector(baseConnector).sameMetadataAs(newOutputMetadata)))) {
        targetNode.metadataInputChanged(currentIO,currentIO.getUniqueName());
        if (isExecute) {
          if (targetNode instanceof Node) {
            if (((Node)targetNode).getComponent().isSchemaAutoPropagated() && getPropagate() && targetNode.getMetadataList().size() > 0) {
              IMetadataTable tmpClone;
              if (sourceIsBuiltIn) {
                IMetadataTable tab=node.getMetadataTable(currentIO.getConnection().getMetadataTable().getTableName());
                if (tab == null && node.getJobletNode() != null) {
                  tab=node.getJobletNode().getMetadataTable(currentIO.getConnection().getMetadataTable().getTableName());
                }
                tmpClone=tab.clone(true);
              }
 else {
                IMetadataTable tab=node.getMetadataFromConnector(currentIO.getConnection().getConnectorName());
                if (tab == null && node.getJobletNode() != null) {
                  tab=node.getJobletNode().getMetadataFromConnector(currentIO.getConnection().getConnectorName());
                }
                tmpClone=tab.clone(true);
              }
              IMetadataTable toCopy=newOutputMetadata.clone();
              String dbmsId=null;
              IMetadataTable copy;
              if (((Node)targetNode).getMetadataFromConnector(baseConnector) != null) {
                dbmsId=targetNode.getMetadataFromConnector(baseConnector).getDbms();
                MetadataToolHelper.copyTable(dbmsId,toCopy,tmpClone);
                toCopy=tmpClone;
                copy=((Node)targetNode).getMetadataFromConnector(baseConnector).clone(true);
              }
 else {
                final String mainConnector="String_Node_Str";
                dbmsId=targetNode.getMetadataFromConnector(mainConnector).getDbms();
                MetadataToolHelper.copyTable(dbmsId,toCopy,tmpClone);
                toCopy=tmpClone;
                copy=((Node)targetNode).getMetadataFromConnector(mainConnector).clone(true);
              }
              MetadataToolHelper.copyTable(dbmsId,toCopy,copy);
              ChangeMetadataCommand cmd=new ChangeMetadataCommand(targetNode,null,null,copy,inputSchemaParam);
              if (outputdataContainer.getOuputs().size() > 0) {
                List<ColumnNameChanged> columnNameChanged=outputdataContainer.getOuputs().get(0).getColumnNameChanged();
                for (                IODataComponent dataComp : cmd.outputdataContainer.getOuputs()) {
                  dataComp.setColumnNameChanged(columnNameChanged);
                }
              }
              cmd.setRepositoryMode(repositoryMode);
              cmd.execute(true);
              propagatedChange.add(cmd);
            }
          }
          currentIO.setTable(oldOutputMetadata);
          currentIO.setColumnNameChanged(null);
        }
 else {
          if (targetNode instanceof Node) {
            if (!targetIsBuiltIn && getPropagate()) {
              if (((Node)targetNode).getComponent().isSchemaAutoPropagated()) {
                if (outputdataContainer.getOuputs().size() > 0) {
                  List<ColumnNameChanged> columnNameChanged=outputdataContainer.getOuputs().get(0).getColumnNameChanged();
                  for (                  ChangeMetadataCommand cmd : propagatedChange) {
                    for (                    IODataComponent dataComp : cmd.outputdataContainer.getOuputs()) {
                      dataComp.setColumnNameChanged(columnNameChanged);
                    }
                  }
                }
              }
            }
          }
          currentIO.setTable(newOutputMetadata);
          currentIO.setColumnNameChanged(null);
        }
      }
    }
  }
 else   if (dataComponent != null) {
    for (    IConnection outgoingConnection : node.getOutgoingConnections()) {
      if (outgoingConnection.getConnectorName().equals(currentConnector)) {
        outgoingConnection.getTarget().metadataInputChanged(dataComponent,outgoingConnection.getName());
      }
    }
  }
 else {
    if (!node.getOutgoingConnections().isEmpty()) {
      IMetadataTable relativeOldOutputMetadata=null;
      IMetadataTable relativeNewOutputMetadata=null;
      if (isExecute) {
        relativeOldOutputMetadata=oldOutputMetadata;
        relativeNewOutputMetadata=newOutputMetadata;
      }
 else {
        relativeOldOutputMetadata=newOutputMetadata;
        relativeNewOutputMetadata=oldOutputMetadata;
      }
      for (      IConnection outgoingConnection : node.getOutgoingConnections()) {
        final Node target=(Node)outgoingConnection.getTarget();
        if (target != null && target.getExternalNode() != null) {
          List<IMetadataColumn> oldListColumns=relativeOldOutputMetadata.getListColumns();
          List<IMetadataColumn> newListColumns=relativeNewOutputMetadata.getListColumns();
          List<ColumnNameChanged> columnNameChanges=new ArrayList<ColumnNameChanged>();
          int size=oldListColumns.size();
          int newSize=newListColumns.size();
          if (newSize < size) {
            size=newSize;
          }
          IODataComponent output=new IODataComponent(outgoingConnection,relativeNewOutputMetadata);
          if (newListColumns != null) {
            List<ColumnNameChanged> newColumnsList=output.getNewMetadataColumns();
            Set<String> newAddedColumns=new HashSet<String>();
            Set<String> newestColumns=new HashSet<String>();
            if (newColumnsList != null) {
              for (              ColumnNameChanged columnChanged : newColumnsList) {
                newAddedColumns.add(columnChanged.getNewName());
              }
            }
            for (            IMetadataColumn metadataColumn : newListColumns) {
              newestColumns.add(metadataColumn.getLabel());
            }
            for (int i=0; i < size; i++) {
              IMetadataColumn oldMetadataColumn=oldListColumns.get(i);
              String columnName=oldMetadataColumn.getLabel();
              if (!newestColumns.contains(columnName)) {
                IMetadataColumn newMetadataColumn=newListColumns.get(i);
                String newColumnNameAtThisIndex=newMetadataColumn.getLabel();
                if (newAddedColumns.contains(newColumnNameAtThisIndex)) {
                  columnNameChanges.add(new ColumnNameChanged(columnName,newColumnNameAtThisIndex));
                }
              }
            }
          }
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IXmlMapService.class)) {
            final IXmlMapService service=(IXmlMapService)GlobalServiceRegister.getDefault().getService(IXmlMapService.class);
            if (service.isXmlMapComponent(target.getExternalNode())) {
              output.setColumnNameChanged(columnNameChanges);
              target.metadataInputChanged(output,outgoingConnection.getName());
            }
          }
          if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkMapService.class)) {
            final ISparkMapService service=(ISparkMapService)GlobalServiceRegister.getDefault().getService(ISparkMapService.class);
            if (service.isSparkMapComponent(target.getExternalNode())) {
              output.setColumnNameChanged(columnNameChanges);
              target.metadataInputChanged(output,outgoingConnection.getName());
            }
          }
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapService.class)) {
            final IDbMapService service=(IDbMapService)GlobalServiceRegister.getDefault().getService(IDbMapService.class);
            if (service.isDbMapComponent(target.getExternalNode())) {
              output.setColumnNameChanged(columnNameChanges);
              target.metadataInputChanged(output,outgoingConnection.getName());
            }
          }
        }
      }
    }
  }
  if (inputdataContainer != null) {
    for (    IODataComponent currentIO : inputdataContainer.getOuputs()) {
      if (currentIO.hasChanged() && (currentIO.getSource().getConnectorFromName(currentIO.getConnection().getConnectorName()).getBaseSchema().equals(currentConnector))) {
        INode targetNode=currentIO.getTarget();
        targetNode.metadataInputChanged(currentIO,currentIO.getUniqueName());
        if (isExecute) {
          currentIO.setTable(oldInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
 else {
          currentIO.setTable(newInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
      }
    }
  }
}

Fixed version (ground truth):
private void propagateDatas(boolean isExecute){
  if (schemaParam != null && schemaParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) && EConnectionType.FLOW_MAIN.getDefaultMenuName().toUpperCase().equals(schemaParam.getContext())) {
    currentConnector=EConnectionType.FLOW_MAIN.getName();
  }
  String baseConnectorForCurrentNode=node.getConnectorFromName(currentConnector).getBaseSchema();
  if (outputdataContainer != null && (!outputdataContainer.getInputs().isEmpty() || !outputdataContainer.getOuputs().isEmpty())) {
    for (    IODataComponent currentIO : outputdataContainer.getInputs()) {
      INode sourceNode=currentIO.getSource();
      if (currentIO.hasChanged() && (sourceNode.getConnectorFromName(currentIO.getConnection().getConnectorName()).getBaseSchema().equals(baseConnectorForCurrentNode))) {
        sourceNode.metadataOutputChanged(currentIO,currentIO.getName());
        if (isExecute) {
          currentIO.setTable(oldInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
 else {
          currentIO.setTable(newInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
      }
    }
    for (    IODataComponent currentIO : outputdataContainer.getOuputs()) {
      INodeConnector nodeConnector=null;
      String baseConnector=null;
      Node sourceNode=(Node)currentIO.getSource();
      nodeConnector=sourceNode.getConnectorFromName(currentIO.getConnection().getConnectorName());
      baseConnector=nodeConnector.getBaseSchema();
      INode targetNode=currentIO.getTarget();
      boolean sourceIsBuiltIn=((Node)currentIO.getSource()).getConnectorFromType(currentIO.getConnection().getLineStyle()).isMultiSchema();
      boolean targetIsBuiltIn=((Node)targetNode).getConnectorFromType(currentIO.getConnection().getLineStyle()).isMultiSchema();
      boolean isJoblet=((Node)targetNode).isJoblet();
      if (!isJoblet && baseConnector.equals(baseConnectorForCurrentNode) && (targetIsBuiltIn || (targetNode.getMetadataFromConnector(baseConnector) != null && !targetNode.getMetadataFromConnector(baseConnector).sameMetadataAs(newOutputMetadata)))) {
        targetNode.metadataInputChanged(currentIO,currentIO.getUniqueName());
        if (isExecute) {
          if (targetNode instanceof Node) {
            if (((Node)targetNode).getComponent().isSchemaAutoPropagated() && getPropagate() && targetNode.getMetadataList().size() > 0) {
              IMetadataTable tmpClone;
              if (sourceIsBuiltIn) {
                IMetadataTable tab=node.getMetadataTable(currentIO.getConnection().getMetadataTable().getTableName());
                if (tab == null && node.getJobletNode() != null) {
                  tab=node.getJobletNode().getMetadataTable(currentIO.getConnection().getMetadataTable().getTableName());
                }
                tmpClone=tab.clone(true);
              }
 else {
                IMetadataTable tab=node.getMetadataFromConnector(currentIO.getConnection().getConnectorName());
                if (tab == null && node.getJobletNode() != null) {
                  tab=node.getJobletNode().getMetadataFromConnector(currentIO.getConnection().getConnectorName());
                }
                tmpClone=tab.clone(true);
              }
              IMetadataTable toCopy=newOutputMetadata.clone();
              String dbmsId=null;
              IMetadataTable copy;
              if (((Node)targetNode).getMetadataFromConnector(baseConnector) != null) {
                dbmsId=targetNode.getMetadataFromConnector(baseConnector).getDbms();
                MetadataToolHelper.copyTable(dbmsId,toCopy,tmpClone);
                toCopy=tmpClone;
                copy=((Node)targetNode).getMetadataFromConnector(baseConnector).clone(true);
              }
 else {
                final String mainConnector="String_Node_Str";
                dbmsId=targetNode.getMetadataFromConnector(mainConnector).getDbms();
                MetadataToolHelper.copyTable(dbmsId,toCopy,tmpClone);
                toCopy=tmpClone;
                copy=((Node)targetNode).getMetadataFromConnector(mainConnector).clone(true);
              }
              MetadataToolHelper.copyTable(dbmsId,toCopy,copy);
              ChangeMetadataCommand cmd=new ChangeMetadataCommand(targetNode,null,null,copy,inputSchemaParam);
              if (outputdataContainer.getOuputs().size() > 0) {
                List<ColumnNameChanged> columnNameChanged=outputdataContainer.getOuputs().get(0).getColumnNameChanged();
                for (                IODataComponent dataComp : cmd.outputdataContainer.getOuputs()) {
                  dataComp.setColumnNameChanged(columnNameChanged);
                }
              }
              cmd.setRepositoryMode(repositoryMode);
              cmd.execute(true);
              propagatedChange.add(cmd);
            }
          }
          currentIO.setTable(oldOutputMetadata);
          currentIO.setColumnNameChanged(null);
        }
 else {
          if (targetNode instanceof Node) {
            if (!targetIsBuiltIn && getPropagate()) {
              if (((Node)targetNode).getComponent().isSchemaAutoPropagated()) {
                if (outputdataContainer.getOuputs().size() > 0) {
                  List<ColumnNameChanged> columnNameChanged=outputdataContainer.getOuputs().get(0).getColumnNameChanged();
                  for (                  ChangeMetadataCommand cmd : propagatedChange) {
                    for (                    IODataComponent dataComp : cmd.outputdataContainer.getOuputs()) {
                      dataComp.setColumnNameChanged(columnNameChanged);
                    }
                  }
                }
              }
            }
          }
          currentIO.setTable(newOutputMetadata);
          currentIO.setColumnNameChanged(null);
        }
      }
    }
  }
 else   if (dataComponent != null) {
    for (    IConnection outgoingConnection : node.getOutgoingConnections()) {
      if (outgoingConnection.getConnectorName().equals(currentConnector)) {
        outgoingConnection.getTarget().metadataInputChanged(dataComponent,outgoingConnection.getName());
      }
    }
  }
 else {
    if (!node.getOutgoingConnections().isEmpty()) {
      IMetadataTable relativeOldOutputMetadata=null;
      IMetadataTable relativeNewOutputMetadata=null;
      if (isExecute) {
        relativeOldOutputMetadata=oldOutputMetadata;
        relativeNewOutputMetadata=newOutputMetadata;
      }
 else {
        relativeOldOutputMetadata=newOutputMetadata;
        relativeNewOutputMetadata=oldOutputMetadata;
      }
      for (      IConnection outgoingConnection : node.getOutgoingConnections()) {
        if (!outgoingConnection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
          continue;
        }
        final Node target=(Node)outgoingConnection.getTarget();
        if (target != null && target.getExternalNode() != null) {
          List<IMetadataColumn> oldListColumns=relativeOldOutputMetadata.getListColumns();
          List<IMetadataColumn> newListColumns=relativeNewOutputMetadata.getListColumns();
          List<ColumnNameChanged> columnNameChanges=new ArrayList<ColumnNameChanged>();
          int size=oldListColumns.size();
          int newSize=newListColumns.size();
          if (newSize < size) {
            size=newSize;
          }
          IODataComponent output=new IODataComponent(outgoingConnection,relativeNewOutputMetadata);
          if (newListColumns != null) {
            List<ColumnNameChanged> newColumnsList=output.getNewMetadataColumns();
            Set<String> newAddedColumns=new HashSet<String>();
            Set<String> newestColumns=new HashSet<String>();
            if (newColumnsList != null) {
              for (              ColumnNameChanged columnChanged : newColumnsList) {
                newAddedColumns.add(columnChanged.getNewName());
              }
            }
            for (            IMetadataColumn metadataColumn : newListColumns) {
              newestColumns.add(metadataColumn.getLabel());
            }
            for (int i=0; i < size; i++) {
              IMetadataColumn oldMetadataColumn=oldListColumns.get(i);
              String columnName=oldMetadataColumn.getLabel();
              if (!newestColumns.contains(columnName)) {
                IMetadataColumn newMetadataColumn=newListColumns.get(i);
                String newColumnNameAtThisIndex=newMetadataColumn.getLabel();
                if (newAddedColumns.contains(newColumnNameAtThisIndex)) {
                  columnNameChanges.add(new ColumnNameChanged(columnName,newColumnNameAtThisIndex));
                }
              }
            }
          }
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IXmlMapService.class)) {
            final IXmlMapService service=(IXmlMapService)GlobalServiceRegister.getDefault().getService(IXmlMapService.class);
            if (service.isXmlMapComponent(target.getExternalNode())) {
              output.setColumnNameChanged(columnNameChanges);
              target.metadataInputChanged(output,outgoingConnection.getName());
            }
          }
          if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkMapService.class)) {
            final ISparkMapService service=(ISparkMapService)GlobalServiceRegister.getDefault().getService(ISparkMapService.class);
            if (service.isSparkMapComponent(target.getExternalNode())) {
              output.setColumnNameChanged(columnNameChanges);
              target.metadataInputChanged(output,outgoingConnection.getName());
            }
          }
          if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapService.class)) {
            final IDbMapService service=(IDbMapService)GlobalServiceRegister.getDefault().getService(IDbMapService.class);
            if (service.isDbMapComponent(target.getExternalNode())) {
              output.setColumnNameChanged(columnNameChanges);
              target.metadataInputChanged(output,outgoingConnection.getName());
            }
          }
        }
      }
    }
  }
  if (inputdataContainer != null) {
    for (    IODataComponent currentIO : inputdataContainer.getOuputs()) {
      if (currentIO.hasChanged() && (currentIO.getSource().getConnectorFromName(currentIO.getConnection().getConnectorName()).getBaseSchema().equals(currentConnector))) {
        INode targetNode=currentIO.getTarget();
        targetNode.metadataInputChanged(currentIO,currentIO.getUniqueName());
        if (isExecute) {
          currentIO.setTable(oldInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
 else {
          currentIO.setTable(newInputMetadata);
          currentIO.setColumnNameChanged(null);
        }
      }
    }
  }
}