Program: 121368
Project: 121368
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) && readOnly) {
      return;
    }
    if (request instanceof CreateRequest && selectedConnectionPart != null) {
      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=(Connection)selectedConnectionPart.getModel();
        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);
            List<Object> nodeArgs=CreateComponentOnLinkHelper.getTargetArgs(targetConnection,node);
            ConnectionCreateCommand nodeCmd=new ConnectionCreateCommand(node,targetConnector.getName(),nodeArgs,false);
            nodeCmd.setTarget(originalTarget);
            execCommandStack(nodeCmd);
            if (node.getOutgoingConnections().size() > 0) {
              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());
            }
            if (!ConnectionCreateCommand.isCreatingConnection()) {
              return;
            }
          }
        }
      }
    }
    if (request instanceof CreateRequest) {
      CreateRequest cRequest=(CreateRequest)request;
      if (cRequest.getNewObject() instanceof Node) {
        Object newObject=(cRequest).getNewObject();
        if (newObject != null) {
          Node node=(Node)newObject;
          if (!node.getComponent().getComponentType().equals(EComponentType.JOBLET)) {
            NodeContainer nodeContainer=new NodeContainer(node);
            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);
            CreateNodeContainerCommand createCmd=new CreateNodeContainerCommand((Process)getProcess(),nodeContainer,point);
            if (createCmd != null) {
              execCommandStack(createCmd);
            }
          }
        }
        IComponent component=((Node)cRequest.getNewObject()).getComponent();
        ModulesInstaller.installModules(getSite().getShell(),component);
      }
    }
  }
 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) && readOnly) {
      return;
    }
    if (request instanceof CreateRequest && selectedConnectionPart != null) {
      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=(Connection)selectedConnectionPart.getModel();
        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);
            List<Object> nodeArgs=CreateComponentOnLinkHelper.getTargetArgs(targetConnection,node);
            ConnectionCreateCommand nodeCmd=new ConnectionCreateCommand(node,targetConnector.getName(),nodeArgs,false);
            nodeCmd.setTarget(originalTarget);
            execCommandStack(nodeCmd);
            if (node.getOutgoingConnections().size() > 0) {
              if (node.getExternalNode() instanceof MapperExternalNode) {
                CreateComponentOnLinkHelper.setupTMap(node);
              }
              if (originalTarget.getExternalNode() instanceof MapperExternalNode) {
                CreateComponentOnLinkHelper.updateTMap(originalTarget,targetConnection,node.getOutgoingConnections().get(0));
              }
              originalTarget.renameData(targetConnection.getName(),node.getOutgoingConnections().get(0).getName());
            }
            if (!ConnectionCreateCommand.isCreatingConnection()) {
              return;
            }
          }
        }
      }
    }
    if (request instanceof CreateRequest) {
      CreateRequest cRequest=(CreateRequest)request;
      if (cRequest.getNewObject() instanceof Node) {
        Object newObject=(cRequest).getNewObject();
        if (newObject != null) {
          Node node=(Node)newObject;
          if (!node.getComponent().getComponentType().equals(EComponentType.JOBLET)) {
            NodeContainer nodeContainer=new NodeContainer(node);
            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);
            CreateNodeContainerCommand createCmd=new CreateNodeContainerCommand((Process)getProcess(),nodeContainer,point);
            if (createCmd != null) {
              execCommandStack(createCmd);
            }
          }
        }
        IComponent component=((Node)cRequest.getNewObject()).getComponent();
        ModulesInstaller.installModules(getSite().getShell(),component);
      }
    }
  }
 catch (  SecurityException e) {
    ExceptionHandler.process(e);
  }
catch (  NoSuchFieldException e) {
    ExceptionHandler.process(e);
  }
catch (  IllegalArgumentException e) {
    ExceptionHandler.process(e);
  }
catch (  IllegalAccessException e) {
    ExceptionHandler.process(e);
  }
}