Program: 121695
Project: 121695
Buggy source:
private void refreshJobletConnections(){
  Iterator<IConnection> inIterator=inputs.iterator();
  while (inIterator.hasNext()) {
    IConnection conn=inIterator.next();
    if (isCollapsed()) {
      ((Connection)conn).reconnect(conn.getSource(),this.node,conn.getLineStyle());
      IConnection[] jobletConns=this.node.getComponent().getProcess().getAllConnections(null);
      if (jobletConns != null) {
        for (int i=0; i < jobletConns.length; i++) {
          this.node.getProcess().removeUniqueConnectionName(jobletConns[i].getUniqueName());
        }
      }
    }
 else {
      for (      NodeContainer nodeContainer : this.nodeContainers) {
        Node connNode=nodeContainer.getNode();
        IElementParameter elePa=this.node.getElementParameter(connNode.getJoblet_unique_name());
        if (elePa != null) {
          IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
          IElementParameter elechild=null;
          String uniqueName=null;
          boolean isTri=service.isTriggerNode(connNode);
          if (service != null && isTri) {
            elechild=elePa.getChildParameters().get("String_Node_Str");
            uniqueName=conn.getMetaName();
          }
 else {
            elechild=elePa.getChildParameters().get("String_Node_Str");
            uniqueName=conn.getUniqueName();
          }
          if (elechild != null && elechild.getValue().equals(uniqueName)) {
            List<? extends INodeConnector> connList=new JobletUtil().createConnectors(connNode,this.getProcess());
            List<INodeConnector> inodeConnList=new ArrayList<INodeConnector>();
            inodeConnList.addAll(connList);
            inodeConnList.addAll(connNode.getListConnector());
            connNode.setListConnector(inodeConnList);
            IMetadataTable iTable=this.node.getMetadataTable(connNode.getUniqueName());
            if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
            }
            JobletConnectionReconnectCommand reConnectCommand=new JobletConnectionReconnectCommand(conn);
            reConnectCommand.setNewTarget(connNode);
            reConnectCommand.execute();
            break;
          }
 else           if (getFlowInput(inputs).size() == 1 && !isTri && new JobletUtil().isJobletInput(connNode,this.getProcess())) {
            JobletConnectionReconnectCommand reConnectCommand=new JobletConnectionReconnectCommand(conn);
            reConnectCommand.setNewTarget(connNode);
            reConnectCommand.execute();
            break;
          }
        }
      }
    }
  }
  Iterator<IConnection> outIterator=outputs.iterator();
  while (outIterator.hasNext()) {
    IConnection conn=outIterator.next();
    if (isCollapsed()) {
      ((Connection)conn).reconnect(this.node,conn.getTarget(),conn.getLineStyle());
    }
 else {
      for (      NodeContainer nodeContainer : this.nodeContainers) {
        Node connNode=nodeContainer.getNode();
        if (conn.getConnectorName().equals(connNode.getJoblet_unique_name())) {
          List<? extends INodeConnector> connList=new JobletUtil().createConnectors(connNode,this.getProcess());
          List<INodeConnector> inodeConnList=new ArrayList<INodeConnector>();
          inodeConnList.addAll(connList);
          inodeConnList.addAll(connNode.getListConnector());
          connNode.setListConnector(inodeConnList);
          IMetadataTable iTable=this.node.getMetadataTable(connNode.getUniqueName());
          if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
          }
          JobletConnectionReconnectCommand reConnectCommand=new JobletConnectionReconnectCommand(conn);
          reConnectCommand.setNewSource(connNode);
          reConnectCommand.execute();
        }
      }
    }
  }
  if (!isCollapsed()) {
    for (    NodeContainer nodeContainer : this.nodeContainers) {
      Node connNode=nodeContainer.getNode();
      IProcess jobletProcess=this.getNode().getComponent().getProcess();
      List<? extends INode> jobletNodes=jobletProcess.getGraphicalNodes();
      for (      INode n : jobletNodes) {
        if (connNode.getJoblet_unique_name().equals(n.getUniqueName())) {
          connNode.setDummy(n.isDummy());
          connNode.setActivate(n.isActivate());
        }
      }
    }
  }
}

Fixed version (ground truth):
private void refreshJobletConnections(){
  Iterator<IConnection> inIterator=inputs.iterator();
  while (inIterator.hasNext()) {
    IConnection conn=inIterator.next();
    if (isCollapsed()) {
      ((Connection)conn).reconnect(conn.getSource(),this.node,conn.getLineStyle());
      IConnection[] jobletConns=this.node.getComponent().getProcess().getAllConnections(null);
      if (jobletConns != null) {
        for (int i=0; i < jobletConns.length; i++) {
          this.node.getProcess().removeUniqueConnectionName(jobletConns[i].getUniqueName());
        }
      }
    }
 else {
      for (      NodeContainer nodeContainer : this.nodeContainers) {
        Node connNode=nodeContainer.getNode();
        IElementParameter elePa=this.node.getElementParameter(connNode.getJoblet_unique_name());
        if (elePa != null) {
          IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
          IElementParameter elechild=null;
          String uniqueName=null;
          boolean isTri=service.isTriggerNode(connNode);
          if (service != null && isTri) {
            elechild=elePa.getChildParameters().get("String_Node_Str");
            uniqueName=conn.getMetaName();
          }
 else {
            elechild=elePa.getChildParameters().get("String_Node_Str");
            uniqueName=conn.getUniqueName();
          }
          if (elechild != null && elechild.getValue().equals(uniqueName)) {
            List<? extends INodeConnector> connList=new JobletUtil().createConnectors(connNode,this.getProcess());
            List<INodeConnector> inodeConnList=new ArrayList<INodeConnector>();
            inodeConnList.addAll(connList);
            inodeConnList.addAll(connNode.getListConnector());
            connNode.setListConnector(inodeConnList);
            IMetadataTable iTable=this.node.getMetadataTable(connNode.getUniqueName());
            if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
            }
            JobletConnectionReconnectCommand reConnectCommand=new JobletConnectionReconnectCommand(conn);
            reConnectCommand.setNewTarget(connNode);
            reConnectCommand.execute();
            break;
          }
 else           if (getFlowInput(inputs).size() == 1 && !isTri && new JobletUtil().isJobletInput(connNode,this.getProcess())) {
            JobletConnectionReconnectCommand reConnectCommand=new JobletConnectionReconnectCommand(conn);
            reConnectCommand.setNewTarget(connNode);
            reConnectCommand.execute();
            break;
          }
        }
      }
    }
  }
  Iterator<IConnection> outIterator=outputs.iterator();
  while (outIterator.hasNext()) {
    IConnection conn=outIterator.next();
    if (isCollapsed()) {
      ((Connection)conn).reconnect(this.node,conn.getTarget(),conn.getLineStyle());
    }
 else {
      for (      NodeContainer nodeContainer : this.nodeContainers) {
        Node connNode=nodeContainer.getNode();
        if (conn.getConnectorName().equals(connNode.getJoblet_unique_name())) {
          List<? extends INodeConnector> connList=new JobletUtil().createConnectors(connNode,this.getProcess());
          List<INodeConnector> inodeConnList=new ArrayList<INodeConnector>();
          inodeConnList.addAll(connList);
          inodeConnList.addAll(connNode.getListConnector());
          connNode.setListConnector(inodeConnList);
          IMetadataTable iTable=this.node.getMetadataTable(connNode.getUniqueName());
          if (iTable != null && !connNode.getMetadataList().contains(iTable)) {
          }
          JobletConnectionReconnectCommand reConnectCommand=new JobletConnectionReconnectCommand(conn);
          reConnectCommand.setNewSource(connNode);
          reConnectCommand.execute();
        }
      }
    }
  }
  if (!isCollapsed()) {
    for (    NodeContainer nodeContainer : this.nodeContainers) {
      Node connNode=nodeContainer.getNode();
      IProcess jobletProcess=this.getNode().getComponent().getProcess();
      List<? extends INode> jobletNodes=jobletProcess.getGraphicalNodes();
      for (      INode n : jobletNodes) {
        if (connNode.getJoblet_unique_name().equals(n.getUniqueName())) {
          connNode.setDummy(n.isDummy());
        }
      }
    }
  }
}