Program: 123487
Project: 123487
Buggy source:
private void updateNodeOnLink(CreationTool tool){
  try {
    Class toolClass=TargetingTool.class;
    Field targetRequestField=toolClass.getDeclaredField("String_Node_Str");
    Field targetEditpartField=toolClass.getDeclaredField("String_Node_Str");
    targetRequestField.setAccessible(true);
    targetEditpartField.setAccessible(true);
    Request request=(Request)targetRequestField.get(tool);
    EditPart editPart=(EditPart)targetEditpartField.get(tool);
    if (request instanceof CreateRequest && editPart instanceof SubjobContainerPart) {
      Object object=((CreateRequest)request).getNewObject();
      if (object instanceof Node) {
        Node node=(Node)object;
        Point originalPoint=((CreateRequest)request).getLocation();
        RootEditPart rep=getViewer().getRootEditPart().getRoot();
        Point viewOriginalPosition=new Point();
        if (rep instanceof ScalableFreeformRootEditPart) {
          ScalableFreeformRootEditPart root=(ScalableFreeformRootEditPart)rep;
          Viewport viewport=(Viewport)root.getFigure();
          viewOriginalPosition=viewport.getViewLocation();
        }
        Point point=new Point(originalPoint.x + viewOriginalPosition.x,originalPoint.y + viewOriginalPosition.y);
        Connection targetConnection=CreateComponentOnLinkHelper.getSelectedConnection();
        for (        Object child : getProcessPart().getChildren()) {
          if (child instanceof SubjobContainerPart) {
            CreateComponentOnLinkHelper.unselectAllConnections((SubjobContainerPart)child);
          }
        }
        if (targetConnection != null) {
          NodeContainer nodeContainer=new NodeContainer(node);
          if (getProcess() instanceof Process) {
            execCommandStack(new CreateNodeContainerCommand((Process)getProcess(),nodeContainer,point));
            Node originalTarget=(Node)targetConnection.getTarget();
            INodeConnector targetConnector=node.getConnectorFromType(EConnectionType.FLOW_MAIN);
            for (            INodeConnector connector : node.getConnectorsFromType(EConnectionType.FLOW_MAIN)) {
              if (connector.getMaxLinkOutput() != 0) {
                targetConnector=connector;
                break;
              }
            }
            ConnectionCreateCommand.setCreatingConnection(true);
            if (PluginChecker.isJobLetPluginLoaded()) {
              IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
              if (service != null && service.isJobletComponent(targetConnection.getTarget())) {
                if (targetConnection.getTarget() instanceof Node) {
                  NodeContainer jobletContainer=((Node)targetConnection.getTarget()).getNodeContainer();
                  jobletContainer.getInputs().remove(targetConnection);
                }
              }
            }
            EConnectionType reconnectNewInputStyle=targetConnection.getLineStyle();
            if (ConnectionManager.canConnectToTarget(targetConnection.getSource(),originalTarget,node,targetConnection.getLineStyle(),targetConnection.getName(),targetConnector.getName())) {
              reconnectNewInputStyle=ConnectionManager.getNewConnectionType();
            }
            if (reconnectNewInputStyle.equals(EConnectionType.FLOW_MAIN)) {
              targetConnection.reconnect(targetConnection.getSource(),node,EConnectionType.FLOW_MAIN);
            }
 else             if (reconnectNewInputStyle.equals(EConnectionType.FLOW_MERGE)) {
              targetConnection.reconnect(targetConnection.getSource(),node,EConnectionType.FLOW_MERGE);
            }
 else             if (reconnectNewInputStyle.equals(EConnectionType.FLOW_REF)) {
              targetConnection.reconnect(targetConnection.getSource(),node,EConnectionType.FLOW_REF);
            }
            INodeConnector nodeConnector=node.getConnectorFromName(targetConnector.getName());
            nodeConnector.setCurLinkNbInput(nodeConnector.getCurLinkNbInput() + 1);
            List<Object> nodeArgs=CreateComponentOnLinkHelper.getTargetArgs(targetConnection,node);
            ConnectionCreateCommand nodeCmd=new ConnectionCreateCommand(node,targetConnector.getName(),nodeArgs,false);
            nodeCmd.setTarget(originalTarget);
            INodeConnector originalNodeConnector=originalTarget.getConnectorFromName(targetConnection.getTargetNodeConnector().getName());
            originalNodeConnector.setCurLinkNbInput(originalNodeConnector.getCurLinkNbInput() - 1);
            execCommandStack(nodeCmd);
            if (node.getComponent().getName().equals("String_Node_Str")) {
              CreateComponentOnLinkHelper.setupTMap(node);
            }
            if (originalTarget.getComponent().getName().equals("String_Node_Str")) {
              CreateComponentOnLinkHelper.updateTMap(originalTarget,targetConnection,node.getOutgoingConnections().get(0));
            }
            originalTarget.renameData(targetConnection.getName(),node.getOutgoingConnections().get(0).getName());
          }
        }
      }
    }
  }
 catch (  SecurityException e) {
    ExceptionHandler.process(e);
  }
catch (  NoSuchFieldException e) {
    ExceptionHandler.process(e);
  }
catch (  IllegalArgumentException e) {
    ExceptionHandler.process(e);
  }
catch (  IllegalAccessException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
private void updateNodeOnLink(CreationTool tool){
  try {
    Class toolClass=TargetingTool.class;
    Field targetRequestField=toolClass.getDeclaredField("String_Node_Str");
    Field targetEditpartField=toolClass.getDeclaredField("String_Node_Str");
    targetRequestField.setAccessible(true);
    targetEditpartField.setAccessible(true);
    Request request=(Request)targetRequestField.get(tool);
    EditPart editPart=(EditPart)targetEditpartField.get(tool);
    if (request instanceof CreateRequest && editPart instanceof SubjobContainerPart) {
      Object object=((CreateRequest)request).getNewObject();
      if (object instanceof Node) {
        Node node=(Node)object;
        Point originalPoint=((CreateRequest)request).getLocation();
        RootEditPart rep=getViewer().getRootEditPart().getRoot();
        Point viewOriginalPosition=new Point();
        if (rep instanceof ScalableFreeformRootEditPart) {
          ScalableFreeformRootEditPart root=(ScalableFreeformRootEditPart)rep;
          Viewport viewport=(Viewport)root.getFigure();
          viewOriginalPosition=viewport.getViewLocation();
        }
        Point point=new Point(originalPoint.x + viewOriginalPosition.x,originalPoint.y + viewOriginalPosition.y);
        Connection targetConnection=CreateComponentOnLinkHelper.getSelectedConnection();
        for (        Object child : getProcessPart().getChildren()) {
          if (child instanceof SubjobContainerPart) {
            CreateComponentOnLinkHelper.unselectAllConnections((SubjobContainerPart)child);
          }
        }
        if (targetConnection != null) {
          NodeContainer nodeContainer=new NodeContainer(node);
          if (getProcess() instanceof Process) {
            CreateNodeContainerCommand createCmd=new CreateNodeContainerCommand((Process)getProcess(),nodeContainer,point);
            execCommandStack(createCmd);
            Node originalTarget=(Node)targetConnection.getTarget();
            INodeConnector targetConnector=node.getConnectorFromType(EConnectionType.FLOW_MAIN);
            for (            INodeConnector connector : node.getConnectorsFromType(EConnectionType.FLOW_MAIN)) {
              if (connector.getMaxLinkOutput() != 0) {
                targetConnector=connector;
                break;
              }
            }
            ConnectionCreateCommand.setCreatingConnection(true);
            if (PluginChecker.isJobLetPluginLoaded()) {
              IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
              if (service != null && service.isJobletComponent(targetConnection.getTarget())) {
                if (targetConnection.getTarget() instanceof Node) {
                  NodeContainer jobletContainer=((Node)targetConnection.getTarget()).getNodeContainer();
                  jobletContainer.getInputs().remove(targetConnection);
                }
              }
            }
            ConnectionReconnectCommand cmd2=new ConnectionReconnectCommand(targetConnection);
            cmd2.setNewTarget(node);
            execCommandStack(cmd2);
            INodeConnector nodeConnector=node.getConnectorFromName(targetConnector.getName());
            nodeConnector.setCurLinkNbInput(nodeConnector.getCurLinkNbInput() + 1);
            List<Object> nodeArgs=CreateComponentOnLinkHelper.getTargetArgs(targetConnection,node);
            ConnectionCreateCommand nodeCmd=new ConnectionCreateCommand(node,targetConnector.getName(),nodeArgs,false);
            nodeCmd.setTarget(originalTarget);
            INodeConnector originalNodeConnector=originalTarget.getConnectorFromName(targetConnection.getTargetNodeConnector().getName());
            originalNodeConnector.setCurLinkNbInput(originalNodeConnector.getCurLinkNbInput() - 1);
            execCommandStack(nodeCmd);
            if (node.getComponent().getName().equals("String_Node_Str")) {
              CreateComponentOnLinkHelper.setupTMap(node);
            }
            if (originalTarget.getComponent().getName().equals("String_Node_Str")) {
              CreateComponentOnLinkHelper.updateTMap(originalTarget,targetConnection,node.getOutgoingConnections().get(0));
            }
            originalTarget.renameData(targetConnection.getName(),node.getOutgoingConnections().get(0).getName());
          }
        }
      }
    }
  }
 catch (  SecurityException e) {
    ExceptionHandler.process(e);
  }
catch (  NoSuchFieldException e) {
    ExceptionHandler.process(e);
  }
catch (  IllegalArgumentException e) {
    ExceptionHandler.process(e);
  }
catch (  IllegalAccessException e) {
    ExceptionHandler.process(e);
  }
}