Program: 117951
Project: 117951
Buggy source:
public void refreshJobletNodes(boolean update,boolean coll){
  if (this.node.isJoblet()) {
    if (!coll || update) {
      JobletUtil util=new JobletUtil();
      IProcess jobletProcess=this.getNode().getComponent().getProcess();
      Set<IConnection> conns=new HashSet<IConnection>();
      List<? extends INode> jobletNodes=jobletProcess.getGraphicalNodes();
      boolean lockByOther=false;
      if (jobletProcess instanceof IProcess2) {
        lockByOther=util.lockByOthers(((IProcess2)jobletProcess).getProperty().getItem());
      }
      Map<String,List<? extends IElementParameter>> paraMap=new HashMap<String,List<? extends IElementParameter>>();
      for (      NodeContainer nc : nodeContainers) {
        if (this.node.getProcess() instanceof IProcess2) {
          if (!update) {
            paraMap.put(nc.getNode().getJoblet_unique_name(),nc.getNode().getElementParameters());
          }
          ((IProcess2)this.node.getProcess()).removeUniqueNodeName(nc.getNode().getUniqueName());
        }
      }
      nodeContainers.clear();
      jobletElements.clear();
      for (      INode inode : jobletNodes) {
        if ((inode instanceof Node)) {
          Node temNode=(Node)inode;
          conns.addAll(temNode.getIncomingConnections());
          conns.addAll(temNode.getOutgoingConnections());
          Node jnode=util.cloneNode(temNode,this.node.getProcess(),paraMap,lockByOther);
          if (!this.node.isActivate()) {
            jnode.setActivate(this.node.isActivate());
          }
          NodeContainer nodeContainer=util.cloneNodeContainer(temNode.getNodeContainer(),jnode);
          jnode.setJobletnode(this.node);
          jnode.setJoblet_unique_name(temNode.getUniqueName());
          this.nodeContainers.add(nodeContainer);
          this.jobletElements.add(jnode);
          this.jobletElements.add(jnode.getNodeLabel());
          this.jobletElements.add(jnode.getNodeError());
          this.jobletElements.add(jnode.getNodeProgressBar());
        }
      }
      for (      IConnection con : conns) {
        String sourceName=con.getSource().getUniqueName();
        String targetName=con.getTarget().getUniqueName();
        Node sourceNode=null;
        Node targetNode=null;
        for (        NodeContainer nodeC : nodeContainers) {
          Node connNode=nodeC.getNode();
          if (connNode.getJoblet_unique_name().equals(sourceName)) {
            sourceNode=connNode;
          }
          if (connNode.getJoblet_unique_name().equals(targetName)) {
            targetNode=connNode;
          }
          if (sourceNode != null && targetNode != null) {
            util.cloneConnection(con,sourceNode,targetNode);
            break;
          }
        }
      }
    }
  }
 else   if (this.node.isMapReduceStart()) {
    Integer mrGroupId=node.getMrGroupId();
    List<? extends INode> mapReduceNodes=this.node.getProcess().getGraphicalNodes();
    List<Node> nodeList=new ArrayList<Node>();
    if (node.getNodeContainer().getSubjobContainer() != null && node.getNodeContainer().getSubjobContainer().isCollapsed()) {
      nodeList.add(node);
    }
 else {
      for (      INode inode : mapReduceNodes) {
        if ((inode instanceof Node)) {
          Node temNode=(Node)inode;
          if (temNode.getMrGroupId() != null && mrGroupId != null && temNode.getMrGroupId().equals(mrGroupId)) {
            nodeList.add(temNode);
          }
        }
      }
    }
    nodeContainers.clear();
    jobletElements.clear();
    for (    Node inode : nodeList) {
      if (!inode.isActivate()) {
        continue;
      }
      NodeContainer nodeContainer=inode.getNodeContainer();
      if (nodeContainer instanceof JobletContainer) {
        ((JobletContainer)nodeContainer).setMrStartContainer(this);
      }
      this.nodeContainers.add(nodeContainer);
      this.jobletElements.add(inode);
      this.jobletElements.add(inode.getNodeLabel());
      this.jobletElements.add(inode.getNodeError());
      this.jobletElements.add(inode.getNodeProgressBar());
    }
  }
}

Fixed version (ground truth):
public void refreshJobletNodes(boolean update,boolean coll){
  if (this.node.isJoblet()) {
    if (!coll || update) {
      boolean componentUpdated=false;
      IComponent oldComponent=node.getComponent();
      if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
        IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
        IComponent newComponent=service.getUpdatedJobletComponent(oldComponent);
        if (oldComponent != newComponent) {
          node.setComponent(newComponent);
          componentUpdated=true;
        }
      }
      JobletUtil util=new JobletUtil();
      IProcess jobletProcess=this.getNode().getComponent().getProcess();
      Set<IConnection> conns=new HashSet<IConnection>();
      List<? extends INode> jobletNodes=jobletProcess.getGraphicalNodes();
      boolean lockByOther=false;
      if (jobletProcess instanceof IProcess2) {
        lockByOther=util.lockByOthers(((IProcess2)jobletProcess).getProperty().getItem());
      }
      Map<String,List<? extends IElementParameter>> paraMap=new HashMap<String,List<? extends IElementParameter>>();
      if (!componentUpdated) {
        for (        NodeContainer nc : nodeContainers) {
          if (this.node.getProcess() instanceof IProcess2) {
            if (!update) {
              paraMap.put(nc.getNode().getJoblet_unique_name(),nc.getNode().getElementParameters());
            }
            ((IProcess2)this.node.getProcess()).removeUniqueNodeName(nc.getNode().getUniqueName());
          }
        }
      }
      nodeContainers.clear();
      jobletElements.clear();
      for (      INode inode : jobletNodes) {
        if ((inode instanceof Node)) {
          Node temNode=(Node)inode;
          conns.addAll(temNode.getIncomingConnections());
          conns.addAll(temNode.getOutgoingConnections());
          Node jnode=util.cloneNode(temNode,this.node.getProcess(),paraMap,lockByOther);
          if (!this.node.isActivate()) {
            jnode.setActivate(this.node.isActivate());
          }
          NodeContainer nodeContainer=util.cloneNodeContainer(temNode.getNodeContainer(),jnode);
          jnode.setJobletnode(this.node);
          jnode.setJoblet_unique_name(temNode.getUniqueName());
          this.nodeContainers.add(nodeContainer);
          this.jobletElements.add(jnode);
          this.jobletElements.add(jnode.getNodeLabel());
          this.jobletElements.add(jnode.getNodeError());
          this.jobletElements.add(jnode.getNodeProgressBar());
        }
      }
      for (      IConnection con : conns) {
        String sourceName=con.getSource().getUniqueName();
        String targetName=con.getTarget().getUniqueName();
        Node sourceNode=null;
        Node targetNode=null;
        for (        NodeContainer nodeC : nodeContainers) {
          Node connNode=nodeC.getNode();
          if (connNode.getJoblet_unique_name().equals(sourceName)) {
            sourceNode=connNode;
          }
          if (connNode.getJoblet_unique_name().equals(targetName)) {
            targetNode=connNode;
          }
          if (sourceNode != null && targetNode != null) {
            util.cloneConnection(con,sourceNode,targetNode);
            break;
          }
        }
      }
    }
  }
 else   if (this.node.isMapReduceStart()) {
    Integer mrGroupId=node.getMrGroupId();
    List<? extends INode> mapReduceNodes=this.node.getProcess().getGraphicalNodes();
    List<Node> nodeList=new ArrayList<Node>();
    if (node.getNodeContainer().getSubjobContainer() != null && node.getNodeContainer().getSubjobContainer().isCollapsed()) {
      nodeList.add(node);
    }
 else {
      for (      INode inode : mapReduceNodes) {
        if ((inode instanceof Node)) {
          Node temNode=(Node)inode;
          if (temNode.getMrGroupId() != null && mrGroupId != null && temNode.getMrGroupId().equals(mrGroupId)) {
            nodeList.add(temNode);
          }
        }
      }
    }
    nodeContainers.clear();
    jobletElements.clear();
    for (    Node inode : nodeList) {
      if (!inode.isActivate()) {
        continue;
      }
      NodeContainer nodeContainer=inode.getNodeContainer();
      if (nodeContainer instanceof JobletContainer) {
        ((JobletContainer)nodeContainer).setMrStartContainer(this);
      }
      this.nodeContainers.add(nodeContainer);
      this.jobletElements.add(inode);
      this.jobletElements.add(inode.getNodeLabel());
      this.jobletElements.add(inode.getNodeError());
      this.jobletElements.add(inode.getNodeProgressBar());
    }
  }
}