Program: 122376
Project: 122376
Buggy source:
@SuppressWarnings("String_Node_Str") public void checkFlowRefLink(final INode graphicalNode){
  if (checkRefList.contains(graphicalNode)) {
    return;
  }
  checkRefList.add(graphicalNode);
  for (  IConnection connection : graphicalNode.getOutgoingConnections()) {
    if (connection.getTarget().getJobletNode() != null && connection.getSource().getJobletNode() != null) {
      continue;
    }
    if (connection.isActivate() && connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_HASH)) {
      boolean runAfter=true;
      INode target=connection.getTarget();
      if (target != null) {
        IExternalNode externalNode=target.getExternalNode();
        if (externalNode != null) {
          runAfter=externalNode.isRunRefSubProcessAtStart(connection.getUniqueName());
        }
      }
      INode refSource=buildCheckMap.get(graphicalNode);
      if (refSource.getComponent().isHashComponent()) {
        continue;
      }
      INode subNodeStartTarget=graphicalNode.getSubProcessStartNode(true);
      INode subNodeStartSource=connection.getTarget().getSubProcessStartNode(false);
      AbstractNode subDataNodeStartSource=(AbstractNode)buildCheckMap.get(subNodeStartSource);
      AbstractNode subDataNodeStartTarget=(AbstractNode)buildCheckMap.get(subNodeStartTarget);
      if (subDataNodeStartSource == null || subDataNodeStartTarget == null) {
        continue;
      }
      List<IConnection> outgoingConnections=(List<IConnection>)subDataNodeStartSource.getOutgoingConnections();
      List<IConnection> incomingConnections=(List<IConnection>)subDataNodeStartTarget.getIncomingConnections();
      DataConnection dataConnec=null;
      if (runAfter) {
        boolean isParall=false;
        for (        IConnection conn : graphicalNode.getOutgoingConnections()) {
          if (conn.getTarget().getComponent().getName().equals("String_Node_Str")) {
            IElementParameter elePara=conn.getTarget().getElementParameter("String_Node_Str");
            isParall=(Boolean)elePara.getValue();
            break;
          }
        }
        if (isParall) {
          addVParallelizeBetween(subDataNodeStartSource,subDataNodeStartTarget,connection,duplicatedProcess,connection.getElementParameters());
        }
 else {
          dataConnec=new DataConnection();
          dataConnec.setActivate(connection.isActivate());
          dataConnec.setLineStyle(EConnectionType.RUN_AFTER);
          dataConnec.setTraceConnection(connection.isTraceConnection());
          dataConnec.setTracesCondition(connection.getTracesCondition());
          dataConnec.setEnabledTraceColumns(connection.getEnabledTraceColumns());
          dataConnec.setMonitorConnection(connection.isMonitorConnection());
          if (!subDataNodeStartSource.getMetadataList().isEmpty()) {
            dataConnec.setMetadataTable(subDataNodeStartSource.getMetadataList().get(0));
          }
          dataConnec.setName("String_Node_Str" + subDataNodeStartSource.getUniqueName());
          dataConnec.setConnectorName(EConnectionType.RUN_AFTER.getName());
          dataConnec.setSource(subDataNodeStartSource);
          dataConnec.setTarget(subDataNodeStartTarget);
          subDataNodeStartTarget.setStart(false);
          outgoingConnections.add(dataConnec);
          incomingConnections.add(dataConnec);
        }
      }
      String uniqueName=null;
      IComponent component=null;
      String baseConnector=connection.getSource().getConnectorFromName(connection.getConnectorName()).getBaseSchema();
      INodeConnector connector=connection.getTarget().getConnectorFromName(baseConnector);
      String hashComponent=connector.getConnectionProperty(EConnectionType.FLOW_REF).getLinkedComponent();
      if (hashComponent == null) {
        uniqueName=HASH_COMPONENT_NAME + "String_Node_Str" + connection.getName();
        component=ComponentsFactoryProvider.getInstance().get(HASH_COMPONENT_NAME);
      }
 else {
        uniqueName=hashComponent + "String_Node_Str" + connection.getName();
        component=ComponentsFactoryProvider.getInstance().get(hashComponent);
      }
      if (component == null) {
        continue;
      }
      DataNode hashNode=new DataNode(component,uniqueName);
      hashNode.setActivate(connection.isActivate());
      hashNode.setStart(false);
      hashNode.setDesignSubjobStartNode(graphicalNode.getDesignSubjobStartNode());
      IMetadataTable newMetadata=connection.getMetadataTable().clone();
      newMetadata.setTableName(uniqueName);
      hashNode.getMetadataList().remove(0);
      hashNode.getMetadataList().add(newMetadata);
      hashNode.setSubProcessStart(false);
      hashNode.setProcess(graphicalNode.getProcess());
      outgoingConnections=new ArrayList<IConnection>();
      incomingConnections=new ArrayList<IConnection>();
      hashNode.setIncomingConnections(incomingConnections);
      hashNode.setOutgoingConnections(outgoingConnections);
      if (hashComponent != null) {
        List<IMultipleComponentManager> mcms=connection.getTarget().getComponent().getMultipleComponentManagers();
        for (        IMultipleComponentManager mcm : mcms) {
          if (mcm.isLookupMode()) {
            Map<IMultipleComponentItem,AbstractNode> itemsMap=new HashMap<IMultipleComponentItem,AbstractNode>();
            mcm.getItemList().clear();
            mcm.addItem("String_Node_Str",hashComponent);
            itemsMap.put(mcm.getItemList().get(0),hashNode);
            setMultipleComponentParameters(mcm,itemsMap,connection.getTarget());
          }
        }
      }
      addDataNode(hashNode);
      dataConnec=new DataConnection();
      dataConnec.setActivate(connection.isActivate());
      dataConnec.setLineStyle(EConnectionType.FLOW_MAIN);
      dataConnec.setMetadataTable(newMetadata);
      dataConnec.setTraceConnection(connection.isTraceConnection());
      dataConnec.setMonitorConnection(connection.isMonitorConnection());
      dataConnec.setTracesCondition(connection.getTracesCondition());
      dataConnec.setEnabledTraceColumns(connection.getEnabledTraceColumns());
      dataConnec.setName(connection.getName());
      dataConnec.setSource(refSource);
      dataConnec.setTarget(hashNode);
      dataConnec.setLinkNodeForHash((AbstractNode)buildCheckMap.get(connection.getTarget()));
      dataConnec.setConnectorName(connection.getConnectorName());
      IElementParameter monitorParam=connection.getElementParameter(EParameterName.MONITOR_CONNECTION.getName());
      if (monitorParam != null && ((Boolean)monitorParam.getValue())) {
        INode meterNode=addvFlowMeterBetween(refSource,hashNode,dataConnec,graphicalNode.getProcess(),connection.getElementParameters());
        List<IConnection> connectionRefList=(List<IConnection>)refSource.getOutgoingConnections(EConnectionType.FLOW_REF);
        IConnection connecToMove=null;
        for (        IConnection curConnection : connectionRefList) {
          if (curConnection.getSource().equals(buildCheckMap.get(connection.getSource())) && curConnection.getTarget().equals(buildCheckMap.get(connection.getTarget()))) {
            connecToMove=curConnection;
          }
        }
        if (connecToMove != null) {
          ((List<IConnection>)refSource.getOutgoingConnections()).remove(connecToMove);
          ((List<IConnection>)meterNode.getOutgoingConnections()).add(0,connecToMove);
          ((DataConnection)connecToMove).setSource(meterNode);
          ((DataConnection)connecToMove).setName(connecToMove.getName());
          ((DataConnection)connecToMove).setUniqueName("String_Node_Str" + connecToMove.getUniqueName());
        }
      }
 else {
        outgoingConnections=(List<IConnection>)refSource.getOutgoingConnections();
        outgoingConnections.add(dataConnec);
        incomingConnections=(List<IConnection>)hashNode.getIncomingConnections();
        incomingConnections.add(dataConnec);
      }
    }
    checkFlowRefLink(connection.getTarget());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void checkFlowRefLink(final INode graphicalNode){
  if (checkRefList.contains(graphicalNode)) {
    return;
  }
  checkRefList.add(graphicalNode);
  for (  IConnection connection : graphicalNode.getOutgoingConnections()) {
    if (connection.getTarget().getJobletNode() != null && connection.getSource().getJobletNode() != null) {
      continue;
    }
    if (connection.isActivate() && connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_HASH)) {
      boolean runAfter=true;
      INode target=connection.getTarget();
      if (target != null) {
        IExternalNode externalNode=target.getExternalNode();
        if (externalNode != null) {
          runAfter=externalNode.isRunRefSubProcessAtStart(connection.getUniqueName());
        }
      }
      INode refSource=buildCheckMap.get(graphicalNode);
      if (refSource.getComponent().isHashComponent()) {
        continue;
      }
      INode subNodeStartTarget=graphicalNode.getSubProcessStartNode(true);
      INode subNodeStartSource=connection.getTarget().getSubProcessStartNode(false);
      AbstractNode subDataNodeStartSource=(AbstractNode)buildCheckMap.get(subNodeStartSource);
      AbstractNode subDataNodeStartTarget=(AbstractNode)buildCheckMap.get(subNodeStartTarget);
      if (subDataNodeStartSource == null || subDataNodeStartTarget == null) {
        continue;
      }
      List<IConnection> outgoingConnections=(List<IConnection>)subDataNodeStartSource.getOutgoingConnections();
      List<IConnection> incomingConnections=(List<IConnection>)subDataNodeStartTarget.getIncomingConnections();
      DataConnection dataConnec=null;
      if (runAfter) {
        boolean isParall=false;
        for (        IConnection conn : graphicalNode.getOutgoingConnections()) {
          if (conn.getTarget().getComponent().getName().equals("String_Node_Str")) {
            IElementParameter elePara=conn.getTarget().getElementParameter("String_Node_Str");
            isParall=(Boolean)elePara.getValue();
            break;
          }
        }
        if (isParall) {
          addVParallelizeBetween(subDataNodeStartSource,subDataNodeStartTarget,connection,duplicatedProcess,connection.getElementParameters());
        }
 else {
          dataConnec=new DataConnection();
          dataConnec.setActivate(connection.isActivate());
          dataConnec.setLineStyle(EConnectionType.RUN_AFTER);
          dataConnec.setTraceConnection(connection.isTraceConnection());
          dataConnec.setTracesCondition(connection.getTracesCondition());
          dataConnec.setEnabledTraceColumns(connection.getEnabledTraceColumns());
          dataConnec.setMonitorConnection(connection.isMonitorConnection());
          if (!subDataNodeStartSource.getMetadataList().isEmpty()) {
            dataConnec.setMetadataTable(subDataNodeStartSource.getMetadataList().get(0));
          }
          dataConnec.setName("String_Node_Str" + subDataNodeStartSource.getUniqueName());
          dataConnec.setConnectorName(EConnectionType.RUN_AFTER.getName());
          dataConnec.setSource(subDataNodeStartSource);
          dataConnec.setTarget(subDataNodeStartTarget);
          subDataNodeStartTarget.setStart(false);
          outgoingConnections.add(dataConnec);
          incomingConnections.add(dataConnec);
        }
      }
      String uniqueName=null;
      IComponent component=null;
      String baseConnector=connection.getSource().getConnectorFromName(connection.getConnectorName()).getBaseSchema();
      INodeConnector connector=connection.getTarget().getConnectorFromName(baseConnector);
      String hashComponent=connector.getConnectionProperty(EConnectionType.FLOW_REF).getLinkedComponent();
      if (hashComponent == null) {
        uniqueName=HASH_COMPONENT_NAME + "String_Node_Str" + connection.getName();
        component=ComponentsFactoryProvider.getInstance().get(HASH_COMPONENT_NAME);
      }
 else {
        uniqueName=hashComponent + "String_Node_Str" + connection.getName();
        component=ComponentsFactoryProvider.getInstance().get(hashComponent);
      }
      if (component == null) {
        continue;
      }
      DataNode hashNode=new DataNode(component,uniqueName);
      hashNode.setActivate(connection.isActivate());
      hashNode.setStart(false);
      hashNode.setDesignSubjobStartNode(graphicalNode.getDesignSubjobStartNode());
      IMetadataTable newMetadata=connection.getMetadataTable().clone();
      newMetadata.setTableName(uniqueName);
      hashNode.getMetadataList().remove(0);
      hashNode.getMetadataList().add(newMetadata);
      hashNode.setSubProcessStart(false);
      hashNode.setProcess(graphicalNode.getProcess());
      outgoingConnections=new ArrayList<IConnection>();
      incomingConnections=new ArrayList<IConnection>();
      hashNode.setIncomingConnections(incomingConnections);
      hashNode.setOutgoingConnections(outgoingConnections);
      if (hashComponent != null) {
        List<IMultipleComponentManager> mcms=connection.getTarget().getComponent().getMultipleComponentManagers();
        for (        IMultipleComponentManager mcm : mcms) {
          if (mcm.isLookupMode()) {
            Map<IMultipleComponentItem,AbstractNode> itemsMap=new HashMap<IMultipleComponentItem,AbstractNode>();
            mcm.getItemList().clear();
            mcm.addItem("String_Node_Str",hashComponent);
            itemsMap.put(mcm.getItemList().get(0),hashNode);
            setMultipleComponentParameters(mcm,itemsMap,connection.getTarget());
          }
        }
      }
      addDataNode(hashNode);
      dataConnec=new DataConnection();
      dataConnec.setActivate(connection.isActivate());
      dataConnec.setLineStyle(EConnectionType.FLOW_MAIN);
      dataConnec.setMetadataTable(newMetadata);
      dataConnec.setTraceConnection(connection.isTraceConnection());
      dataConnec.setMonitorConnection(connection.isMonitorConnection());
      dataConnec.setTracesCondition(connection.getTracesCondition());
      dataConnec.setEnabledTraceColumns(connection.getEnabledTraceColumns());
      dataConnec.setName(connection.getName());
      dataConnec.setSource(refSource);
      dataConnec.setTarget(hashNode);
      dataConnec.setLinkNodeForHash(buildCheckMap.get(connection.getTarget()));
      dataConnec.setConnectorName(connection.getConnectorName());
      IElementParameter monitorParam=connection.getElementParameter(EParameterName.MONITOR_CONNECTION.getName());
      if (monitorParam != null && ((Boolean)monitorParam.getValue())) {
        INode meterNode=addvFlowMeterBetween(refSource,hashNode,dataConnec,graphicalNode.getProcess(),connection.getElementParameters());
        List<IConnection> connectionRefList=(List<IConnection>)refSource.getOutgoingConnections(EConnectionType.FLOW_REF);
        IConnection connecToMove=null;
        for (        IConnection curConnection : connectionRefList) {
          if (curConnection.getSource().equals(buildCheckMap.get(connection.getSource())) && curConnection.getTarget().equals(buildCheckMap.get(connection.getTarget()))) {
            connecToMove=curConnection;
          }
        }
        if (connecToMove != null) {
          ((List<IConnection>)refSource.getOutgoingConnections()).remove(connecToMove);
          ((List<IConnection>)meterNode.getOutgoingConnections()).add(0,connecToMove);
          ((DataConnection)connecToMove).setSource(meterNode);
          ((DataConnection)connecToMove).setName(connecToMove.getName());
          ((DataConnection)connecToMove).setUniqueName("String_Node_Str" + connecToMove.getUniqueName());
        }
      }
 else {
        outgoingConnections=(List<IConnection>)refSource.getOutgoingConnections();
        outgoingConnections.add(dataConnec);
        incomingConnections=(List<IConnection>)hashNode.getIncomingConnections();
        incomingConnections.add(dataConnec);
      }
    }
    checkFlowRefLink(connection.getTarget());
  }
}