Program: 123488
Project: 123488
Buggy source:
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())) {
          ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(oldTarget,null,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) {
      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);
          if (!sameFlag && newTarget.getComponent().isSchemaAutoPropagated() && (targetOldMetadataTable.getListColumns().isEmpty() || getPropagateDialog())) {
            ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(newTarget,null,null,oldMetadataTable);
            changeMetadataCmd.execute(true);
            metadataChanges.add(changeMetadataCmd);
          }
        }
      }
      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):
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())) {
          ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(oldTarget,null,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);
    if (connection != null && connection instanceof Connection) {
      Connection con=(Connection)connection;
      con.setConnected(true);
    }
    connection.reconnect(oldSource,newTarget,newLineStyle);
    connection.updateName();
    if (newTargetSchemaType != null) {
      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);
          if (!sameFlag && newTarget.getComponent().isSchemaAutoPropagated() && (targetOldMetadataTable.getListColumns().isEmpty() || getPropagateDialog())) {
            ChangeMetadataCommand changeMetadataCmd=new ChangeMetadataCommand(newTarget,null,null,oldMetadataTable);
            changeMetadataCmd.execute(true);
            metadataChanges.add(changeMetadataCmd);
          }
        }
      }
      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()));
    }
  }
}