Program: 97632
Project: 97632
Buggy source:
@Override public void performDragOver(DropTargetEvent event){
  Tree tree=treeViewer.getTree();
  TreeItem selected=tree.getItem(treeViewer.getTree().toControl(event.x,event.y));
  event.feedback=DND.FEEDBACK_EXPAND;
  event.detail=DND.DROP_NONE;
  if (selected != null && selected.getData() instanceof RelationTypeSideSorter) {
    ArtifactTransfer artTransfer=ArtifactTransfer.getInstance();
    FileTransfer fileTransfer=FileTransfer.getInstance();
    RelationTypeSideSorter data=(RelationTypeSideSorter)selected.getData();
    if (artTransfer.isSupportedType(event.currentDataType)) {
      try {
        ArtifactData artData=artTransfer.nativeToJava(event.currentDataType);
        Artifact[] selectedArtifacts=artData.getArtifacts();
        String toolTipText="String_Node_Str";
        Artifact relationArtifact=data.getArtifact();
        boolean canRelate=false;
        for (        Artifact i : selectedArtifacts) {
          Artifact sideA=i;
          Artifact sideB=relationArtifact;
          if (data.getSide() == RelationSide.SIDE_B) {
            sideA=relationArtifact;
            sideB=i;
          }
          canRelate=ensureRelationCanBeAdded(data.getRelationType(),sideA,sideB);
          if (!canRelate) {
            toolTipText+=String.format("String_Node_Str",i.getName(),data.getSide().name(),data.getRelationType().getName());
          }
        }
        AccessPolicy policyHandlerService=ServiceUtil.getAccessPolicy();
        boolean matched=policyHandlerService.canRelationBeModified(artifact,Arrays.asList(selectedArtifacts),data,Level.INFO).matched();
        if (matched) {
          event.detail=DND.DROP_COPY;
          tree.setInsertMark(null,false);
        }
 else {
          toolTipText+=(toolTipText.length() == 0 ? "String_Node_Str" : "String_Node_Str");
          toolTipText+="String_Node_Str";
        }
        if (!matched || !canRelate) {
          errorToolTip.setText("String_Node_Str");
          errorToolTip.setMessage(toolTipText);
          errorToolTip.setVisible(true);
        }
 else {
          errorToolTip.setVisible(false);
        }
      }
 catch (      OseeCoreException ex) {
        OseeLog.log(Activator.class,Level.SEVERE,ex);
      }
    }
 else     if (fileTransfer.isSupportedType(event.currentDataType)) {
      IRelationType relationType=data.getRelationType();
      if (relationType.equals(CoreRelationTypes.Verification__Verifier) || relationType.equals(CoreRelationTypes.Uses__TestUnit)) {
        AccessPolicy policyHandlerService=null;
        try {
          policyHandlerService=ServiceUtil.getAccessPolicy();
        }
 catch (        OseeCoreException ex1) {
          OseeLog.log(Activator.class,Level.SEVERE,ex1);
        }
        boolean matched=false;
        if (policyHandlerService != null) {
          try {
            matched=policyHandlerService.canRelationBeModified(artifact,null,data,Level.INFO).matched();
          }
 catch (          OseeCoreException ex) {
            OseeLog.log(Activator.class,Level.SEVERE,ex);
          }
        }
        if (matched) {
          event.detail=DND.DROP_COPY;
        }
      }
    }
  }
 else   if (selected != null && selected.getData() instanceof WrapperForRelationLink) {
    WrapperForRelationLink targetLink=(WrapperForRelationLink)selected.getData();
    IStructuredSelection selection=(IStructuredSelection)treeViewer.getSelection();
    Object obj=selection.getFirstElement();
    if (obj instanceof WrapperForRelationLink) {
      WrapperForRelationLink dropTarget=(WrapperForRelationLink)obj;
      boolean matched=false;
      try {
        AccessPolicy policyHandlerService=ServiceUtil.getAccessPolicy();
        RelationTypeSide rts=new RelationTypeSide(dropTarget.getRelationType(),dropTarget.getRelationSide());
        matched=policyHandlerService.canRelationBeModified(artifact,Arrays.asList(artifact.equals(dropTarget.getArtifactA()) ? dropTarget.getArtifactB() : dropTarget.getArtifactA()),rts,Level.INFO).matched();
      }
 catch (      OseeCoreException ex) {
        OseeLog.log(Activator.class,Level.SEVERE,ex);
      }
      if (!matched) {
        event.detail=DND.DROP_NONE;
        ToolTip tt=new ToolTip(Displays.getActiveShell(),SWT.ICON_ERROR);
        tt.setText("String_Node_Str");
        tt.setMessage("String_Node_Str");
        tt.setVisible(true);
        return;
      }
      if (relationLinkIsInSameGroup(targetLink,dropTarget)) {
        if (isFeedbackAfter) {
          event.feedback=DND.FEEDBACK_INSERT_AFTER;
        }
 else {
          event.feedback=DND.FEEDBACK_INSERT_BEFORE;
        }
        event.detail=DND.DROP_MOVE;
      }
    }
  }
 else {
    tree.setInsertMark(null,false);
  }
}

Fixed version (ground truth):
@Override public void performDragOver(DropTargetEvent event){
  Tree tree=treeViewer.getTree();
  TreeItem selected=tree.getItem(treeViewer.getTree().toControl(event.x,event.y));
  event.feedback=DND.FEEDBACK_EXPAND;
  event.detail=DND.DROP_NONE;
  errorToolTip.setVisible(false);
  if (selected != null && selected.getData() instanceof RelationTypeSideSorter) {
    ArtifactTransfer artTransfer=ArtifactTransfer.getInstance();
    FileTransfer fileTransfer=FileTransfer.getInstance();
    RelationTypeSideSorter data=(RelationTypeSideSorter)selected.getData();
    if (artTransfer.isSupportedType(event.currentDataType)) {
      try {
        ArtifactData artData=artTransfer.nativeToJava(event.currentDataType);
        Artifact[] selectedArtifacts=artData.getArtifacts();
        String toolTipText="String_Node_Str";
        Artifact relationArtifact=data.getArtifact();
        boolean canRelate=false;
        for (        Artifact i : selectedArtifacts) {
          Artifact sideA=i;
          Artifact sideB=relationArtifact;
          if (data.getSide() == RelationSide.SIDE_B) {
            sideA=relationArtifact;
            sideB=i;
          }
          canRelate=ensureRelationCanBeAdded(data.getRelationType(),sideA,sideB);
          if (!canRelate) {
            toolTipText+=String.format("String_Node_Str",i.getName(),data.getSide().name(),data.getRelationType().getName());
          }
        }
        AccessPolicy policyHandlerService=ServiceUtil.getAccessPolicy();
        boolean matched=policyHandlerService.canRelationBeModified(artifact,Arrays.asList(selectedArtifacts),data,Level.INFO).matched();
        if (matched) {
          event.detail=DND.DROP_COPY;
          tree.setInsertMark(null,false);
        }
 else {
          toolTipText+=(toolTipText.length() == 0 ? "String_Node_Str" : "String_Node_Str");
          toolTipText+="String_Node_Str";
        }
        if (!matched || !canRelate) {
          errorToolTip.setText("String_Node_Str");
          errorToolTip.setMessage(toolTipText);
          errorToolTip.setVisible(true);
        }
      }
 catch (      OseeCoreException ex) {
        OseeLog.log(Activator.class,Level.SEVERE,ex);
      }
    }
 else     if (fileTransfer.isSupportedType(event.currentDataType)) {
      IRelationType relationType=data.getRelationType();
      if (relationType.equals(CoreRelationTypes.Verification__Verifier) || relationType.equals(CoreRelationTypes.Uses__TestUnit)) {
        AccessPolicy policyHandlerService=null;
        try {
          policyHandlerService=ServiceUtil.getAccessPolicy();
        }
 catch (        OseeCoreException ex1) {
          OseeLog.log(Activator.class,Level.SEVERE,ex1);
        }
        boolean matched=false;
        if (policyHandlerService != null) {
          try {
            matched=policyHandlerService.canRelationBeModified(artifact,null,data,Level.INFO).matched();
          }
 catch (          OseeCoreException ex) {
            OseeLog.log(Activator.class,Level.SEVERE,ex);
          }
        }
        if (matched) {
          event.detail=DND.DROP_COPY;
        }
      }
    }
  }
 else   if (selected != null && selected.getData() instanceof WrapperForRelationLink) {
    WrapperForRelationLink targetLink=(WrapperForRelationLink)selected.getData();
    IStructuredSelection selection=(IStructuredSelection)treeViewer.getSelection();
    Object obj=selection.getFirstElement();
    if (obj instanceof WrapperForRelationLink) {
      WrapperForRelationLink dropTarget=(WrapperForRelationLink)obj;
      boolean matched=false;
      try {
        AccessPolicy policyHandlerService=ServiceUtil.getAccessPolicy();
        RelationTypeSide rts=new RelationTypeSide(dropTarget.getRelationType(),dropTarget.getRelationSide());
        matched=policyHandlerService.canRelationBeModified(artifact,Arrays.asList(artifact.equals(dropTarget.getArtifactA()) ? dropTarget.getArtifactB() : dropTarget.getArtifactA()),rts,Level.INFO).matched();
      }
 catch (      OseeCoreException ex) {
        OseeLog.log(Activator.class,Level.SEVERE,ex);
      }
      if (!matched) {
        event.detail=DND.DROP_NONE;
        errorToolTip.setText("String_Node_Str");
        errorToolTip.setMessage("String_Node_Str");
        errorToolTip.setVisible(true);
        return;
      }
      if (relationLinkIsInSameGroup(targetLink,dropTarget)) {
        if (isFeedbackAfter) {
          event.feedback=DND.FEEDBACK_INSERT_AFTER;
        }
 else {
          event.feedback=DND.FEEDBACK_INSERT_BEFORE;
        }
        event.detail=DND.DROP_MOVE;
      }
    }
  }
 else {
    tree.setInsertMark(null,false);
  }
}