Program: 118620
Project: 118620
Buggy source:
@Override public void execute(){
  metadataChanges.clear();
  if (newSource != null) {
    INodeConnector connector=oldSource.getConnectorFromName(connectorName);
    connector.setCurLinkNbOutput(connector.getCurLinkNbOutput() - 1);
    connector=newSource.getConnectorFromName(connectorName);
    connector.setCurLinkNbOutput(connector.getCurLinkNbOutput() + 1);
    if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
      newSourceSchemaType=(String)newSource.getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
      boolean builtInNewSource=newSource.getConnectorFromName(connectorName).isMultiSchema();
      boolean builtInOldSource=oldSource.getConnectorFromName(connectorName).isMultiSchema();
      if ((!builtInNewSource) && (!builtInOldSource)) {
        setSchemaToNotBuiltInNode(oldSource,newSource,oldMetadataTable);
        connection.setMetaName(newSource.getUniqueName());
      }
 else {
        if (!builtInNewSource) {
          int num=0;
          for (int i=0; i < oldSource.getMetadataList().size(); i++) {
            IMetadataTable meta=oldSource.getMetadataList().get(i);
            if (meta.getTableName().equals(oldMetadataTable.getTableName())) {
              num=i;
            }
          }
          oldSource.getMetadataList().remove(num);
          setSchemaToNotBuiltInNode(oldSource,newSource,oldMetadataTable);
          connection.setMetaName(newSource.getUniqueName());
        }
        if (!builtInOldSource) {
          IMetadataTable meta=oldMetadataTable.clone();
          meta.setTableName(connection.getUniqueName());
          newSource.getMetadataList().add(meta);
          connection.setMetaName(meta.getTableName());
        }
        if ((builtInOldSource) && (builtInNewSource)) {
          int num=0;
          for (int i=0; i < oldSource.getMetadataList().size(); i++) {
            IMetadataTable meta=oldSource.getMetadataList().get(i);
            if (meta.getTableName().equals(oldMetadataTable.getTableName())) {
              num=i;
            }
          }
          oldSource.getMetadataList().remove(num);
          newSource.getMetadataList().add(oldMetadataTable);
        }
      }
      if (newSourceSchemaType != null) {
        newSource.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(),EmfComponent.BUILTIN);
      }
      if (oldSourceSchemaType != null) {
        oldSource.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(),EmfComponent.BUILTIN);
      }
    }
 else {
      connection.setMetaName(newSource.getUniqueName());
    }
    connection.reconnect(newSource,oldTarget,newLineStyle);
    connection.updateName();
    if (newSourceSchemaType != null && connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
      IMetadataTable sourceMetadataTable=newSource.getMetadataFromConnector(connector.getName());
      if (oldMetadataTable != null && sourceMetadataTable != null) {
        boolean sameFlag=oldMetadataTable.sameMetadataAs(sourceMetadataTable,IMetadataColumn.OPTIONS_NONE);
        if (!sameFlag && oldTarget.getComponent().isSchemaAutoPropagated() && (oldMetadataTable.getListColumns().isEmpty() || getPropagateDialog())) {
          IElementParameter param=newTarget.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
          if (param != null && param.getContext() != null && !param.getContext().equals(connection.getLineStyle().getName())) {
            param=null;
          }
          ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(oldTarget,param,null,sourceMetadataTable);
          changeMetadataCmd.execute(true);
          metadataChanges.add(changeMetadataCmd);
        }
      }
    }
    ((Process)newSource.getProcess()).checkStartNodes();
    ((Process)newSource.getProcess()).checkProcess();
  }
 else   if (newTarget != null) {
    newTargetSchemaType=(String)newTarget.getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
    INodeConnector connector=oldTarget.getConnectorFromType(oldLineStyle);
    connector.setCurLinkNbInput(connector.getCurLinkNbInput() - 1);
    connector=newTarget.getConnectorFromType(newLineStyle);
    connector.setCurLinkNbInput(connector.getCurLinkNbInput() + 1);
    connection.reconnect(oldSource,newTarget,newLineStyle);
    connection.updateName();
    if (newTargetSchemaType != null) {
      boolean isPropagate=false;
      boolean isRepoMode=newTargetSchemaType.equals(EmfComponent.REPOSITORY);
      if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA) && !connection.getLineStyle().equals(EConnectionType.FLOW_REF)) {
        IMetadataTable targetOldMetadataTable=newTarget.getMetadataFromConnector(connector.getName());
        if (oldMetadataTable != null && targetOldMetadataTable != null) {
          boolean sameFlag=oldMetadataTable.sameMetadataAs(targetOldMetadataTable,IMetadataColumn.OPTIONS_NONE);
          isPropagate=(!sameFlag && newTarget.getComponent().isSchemaAutoPropagated() && !isRepoMode&& (targetOldMetadataTable.getListColumns().isEmpty() || getPropagateDialog()));
          if (isPropagate) {
            IElementParameter param=newTarget.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
            if (param != null && param.getContext() != null && !param.getContext().equals(connection.getLineStyle().getName())) {
              param=null;
            }
            ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(newTarget,param,null,oldMetadataTable);
            changeMetadataCmd.execute(true);
            metadataChanges.add(changeMetadataCmd);
          }
        }
      }
      if (isPropagate) {
        newTarget.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(),EmfComponent.BUILTIN);
      }
    }
    ((Process)oldSource.getProcess()).checkStartNodes();
    ((Process)oldSource.getProcess()).checkProcess();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  if (oldSource instanceof Node) {
    if (((Node)oldSource).isJoblet()) {
      ((Node)oldSource).getNodeContainer().setInputs(new HashSet<IConnection>(((Node)oldSource).getInputs()));
      ((Node)oldSource).getNodeContainer().setOutputs(new HashSet<IConnection>(((Node)oldSource).getOutputs()));
    }
  }
  if (oldTarget instanceof Node) {
    if (((Node)oldTarget).isJoblet()) {
      ((Node)oldTarget).getNodeContainer().setInputs(new HashSet<IConnection>(((Node)oldTarget).getInputs()));
      ((Node)oldTarget).getNodeContainer().setOutputs(new HashSet<IConnection>(((Node)oldTarget).getOutputs()));
    }
  }
}

Fixed version (ground truth):
@Override public void execute(){
  metadataChanges.clear();
  if (newSource != null) {
    INodeConnector connector=oldSource.getConnectorFromName(connectorName);
    connector.setCurLinkNbOutput(connector.getCurLinkNbOutput() - 1);
    connector=newSource.getConnectorFromName(connectorName);
    connector.setCurLinkNbOutput(connector.getCurLinkNbOutput() + 1);
    if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
      newSourceSchemaType=(String)newSource.getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
      boolean builtInNewSource=newSource.getConnectorFromName(connectorName).isMultiSchema();
      boolean builtInOldSource=oldSource.getConnectorFromName(connectorName).isMultiSchema();
      if ((!builtInNewSource) && (!builtInOldSource)) {
        setSchemaToNotBuiltInNode(oldSource,newSource,oldMetadataTable);
        connection.setMetaName(newSource.getUniqueName());
      }
 else {
        if (!builtInNewSource) {
          int num=0;
          for (int i=0; i < oldSource.getMetadataList().size(); i++) {
            IMetadataTable meta=oldSource.getMetadataList().get(i);
            if (meta.getTableName().equals(oldMetadataTable.getTableName())) {
              num=i;
            }
          }
          oldSource.getMetadataList().remove(num);
          setSchemaToNotBuiltInNode(oldSource,newSource,oldMetadataTable);
          connection.setMetaName(newSource.getUniqueName());
        }
        if (!builtInOldSource) {
          IMetadataTable meta=oldMetadataTable.clone();
          meta.setTableName(connection.getUniqueName());
          newSource.getMetadataList().add(meta);
          connection.setMetaName(meta.getTableName());
        }
        if ((builtInOldSource) && (builtInNewSource)) {
          int num=0;
          for (int i=0; i < oldSource.getMetadataList().size(); i++) {
            IMetadataTable meta=oldSource.getMetadataList().get(i);
            if (meta.getTableName().equals(oldMetadataTable.getTableName())) {
              num=i;
            }
          }
          oldSource.getMetadataList().remove(num);
          newSource.getMetadataList().add(oldMetadataTable);
        }
      }
      if (newSourceSchemaType != null) {
        newSource.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(),EmfComponent.BUILTIN);
      }
      if (oldSourceSchemaType != null) {
        oldSource.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(),EmfComponent.BUILTIN);
      }
    }
 else {
      connection.setMetaName(newSource.getUniqueName());
    }
    connection.reconnect(newSource,oldTarget,newLineStyle);
    connection.updateName();
    if (newSourceSchemaType != null && connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
      IMetadataTable sourceMetadataTable=newSource.getMetadataFromConnector(connector.getName());
      if (oldMetadataTable != null && sourceMetadataTable != null) {
        boolean sameFlag=oldMetadataTable.sameMetadataAs(sourceMetadataTable,IMetadataColumn.OPTIONS_NONE);
        if (!sameFlag && oldTarget.getComponent().isSchemaAutoPropagated() && (oldMetadataTable.getListColumns().isEmpty() || getPropagateDialog())) {
          IElementParameter param=newTarget.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
          if (param == null) {
            param=newTarget.getElementParameterFromField(EParameterFieldType.SCHEMA_REFERENCE);
          }
          if (param != null && param.getContext() != null && !param.getContext().equals(connection.getLineStyle().getName())) {
            param=null;
          }
          ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(oldTarget,param,null,sourceMetadataTable);
          changeMetadataCmd.execute(true);
          metadataChanges.add(changeMetadataCmd);
        }
      }
    }
    ((Process)newSource.getProcess()).checkStartNodes();
    ((Process)newSource.getProcess()).checkProcess();
  }
 else   if (newTarget != null) {
    newTargetSchemaType=(String)newTarget.getPropertyValue(EParameterName.SCHEMA_TYPE.getName());
    INodeConnector connector=oldTarget.getConnectorFromType(oldLineStyle);
    connector.setCurLinkNbInput(connector.getCurLinkNbInput() - 1);
    connector=newTarget.getConnectorFromType(newLineStyle);
    connector.setCurLinkNbInput(connector.getCurLinkNbInput() + 1);
    connection.reconnect(oldSource,newTarget,newLineStyle);
    connection.updateName();
    if (newTargetSchemaType != null) {
      boolean isPropagate=false;
      boolean isRepoMode=newTargetSchemaType.equals(EmfComponent.REPOSITORY);
      if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA) && !connection.getLineStyle().equals(EConnectionType.FLOW_REF)) {
        IMetadataTable targetOldMetadataTable=newTarget.getMetadataFromConnector(connector.getName());
        if (oldMetadataTable != null && targetOldMetadataTable != null) {
          boolean sameFlag=oldMetadataTable.sameMetadataAs(targetOldMetadataTable,IMetadataColumn.OPTIONS_NONE);
          isPropagate=(!sameFlag && newTarget.getComponent().isSchemaAutoPropagated() && !isRepoMode&& (targetOldMetadataTable.getListColumns().isEmpty() || getPropagateDialog()));
          if (isPropagate) {
            IElementParameter param=newTarget.getElementParameterFromField(EParameterFieldType.SCHEMA_TYPE);
            if (param != null && param.getContext() != null && !param.getContext().equals(connection.getLineStyle().getName())) {
              param=null;
            }
            ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(newTarget,param,null,oldMetadataTable);
            changeMetadataCmd.execute(true);
            metadataChanges.add(changeMetadataCmd);
          }
        }
      }
      if (isPropagate) {
        newTarget.setPropertyValue(EParameterName.SCHEMA_TYPE.getName(),EmfComponent.BUILTIN);
      }
    }
    ((Process)oldSource.getProcess()).checkStartNodes();
    ((Process)oldSource.getProcess()).checkProcess();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
  if (oldSource instanceof Node) {
    if (((Node)oldSource).isJoblet()) {
      ((Node)oldSource).getNodeContainer().setInputs(new HashSet<IConnection>(((Node)oldSource).getInputs()));
      ((Node)oldSource).getNodeContainer().setOutputs(new HashSet<IConnection>(((Node)oldSource).getOutputs()));
    }
  }
  if (oldTarget instanceof Node) {
    if (((Node)oldTarget).isJoblet()) {
      ((Node)oldTarget).getNodeContainer().setInputs(new HashSet<IConnection>(((Node)oldTarget).getInputs()));
      ((Node)oldTarget).getNodeContainer().setOutputs(new HashSet<IConnection>(((Node)oldTarget).getOutputs()));
    }
  }
}