Program: 147798
Project: 147798
Buggy source:
public boolean copyViewObj(IRepositoryViewObject dragViewObj,IRepositoryViewObject dropViewObj){
  if (dropViewObj != null && dragViewObj != null) {
    Property dragProp=dragViewObj.getProperty();
    Property dropProp=dropViewObj.getProperty();
    Item item=dragProp.getItem();
    String name;
    if (item instanceof MDMServerObjectItem) {
      MDMServerObject serverObj=((MDMServerObjectItem)item).getMDMServerObject();
      name=serverObj.getName();
    }
 else {
      name=dragProp.getLabel();
    }
    IRepositoryViewObject dragParentViewObj=getParentRepositoryViewObject(dragViewObj);
    ContainerItem dragParentItem=(ContainerItem)dragParentViewObj.getProperty().getItem();
    String newName=showPasteDlg(dragParentItem.getRepObjType(),dragParentItem,"String_Node_Str" + name);
    if (newName != null) {
      String pathStr=dropProp.getItem().getState().getPath();
      IPath path=new Path(pathStr);
      ERepositoryObjectType type=dropViewObj.getRepositoryObjectType();
      if (type == IServerObjectRepositoryType.TYPE_WORKFLOW) {
        EList refFiles=item.getReferenceResources();
        if (!refFiles.isEmpty()) {
          ReferenceFileItem refFileItem=(ReferenceFileItem)refFiles.get(0);
          byte[] content=refFileItem.getContent().getInnerContent();
          IFolder folder=RepositoryResourceUtil.getFolder(type);
          String fileName=refFileItem.getName().replace(name,newName);
          fileName=fileName.replace("String_Node_Str","String_Node_Str");
          IFile file=folder.getFile(fileName);
          InputStream inputStream=new ByteArrayInputStream(content);
          try {
            if (!file.exists())             file.create(new ByteArrayInputStream(content),IFile.FORCE,new NullProgressMonitor());
 else             file.setContents(new ByteArrayInputStream(content),IFile.FORCE,new NullProgressMonitor());
            file.refreshLocal(IResource.DEPTH_ZERO,new NullProgressMonitor());
            IMDMRepositoryEnterpriseServiceExt service=(IMDMRepositoryEnterpriseServiceExt)GlobalServiceRegister.getDefault().getService(IMDMRepositoryEnterpriseServiceExt.class);
            if (service != null) {
              service.updateWorkflowContent(newName,fileName,inputStream,dragParentViewObj);
            }
            return true;
          }
 catch (          CoreException e) {
            log.error(e.getMessage(),e);
          }
        }
      }
 else {
        IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
        Item copy=null;
        try {
          copy=factory.copy(item,path,true);
          if (factory.isEditableAndLockIfPossible(copy)) {
            if (copy instanceof MDMServerObjectItem) {
              ((MDMServerObjectItem)copy).getMDMServerObject().setName(newName);
              ((MDMServerObjectItem)copy).getMDMServerObject().setLastServerDef(null);
              CommandManager.getInstance().pushCommand(ICommand.CMD_ADD,copy.getProperty().getId(),newName);
            }
            copy.getProperty().setLabel(newName);
            RepositoryResourceUtil.setLastServerDef(copy,null);
            factory.save(copy);
            return true;
          }
        }
 catch (        PersistenceException e) {
          log.error(e.getMessage(),e);
        }
catch (        BusinessException e) {
          log.error(e.getMessage(),e);
        }
 finally {
          try {
            factory.unlock(copy);
          }
 catch (          PersistenceException e) {
            log.error(e.getMessage(),e);
          }
catch (          LoginException e) {
            log.error(e.getMessage(),e);
          }
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean copyViewObj(IRepositoryViewObject dragViewObj,IRepositoryViewObject dropViewObj){
  if (dropViewObj != null && dragViewObj != null) {
    Property dragProp=dragViewObj.getProperty();
    Property dropProp=dropViewObj.getProperty();
    Item item=dragProp.getItem();
    String name;
    if (item instanceof MDMServerObjectItem) {
      MDMServerObject serverObj=((MDMServerObjectItem)item).getMDMServerObject();
      name=serverObj.getName();
    }
 else {
      name=dragProp.getLabel();
    }
    IRepositoryViewObject dragParentViewObj=getParentRepositoryViewObject(dragViewObj);
    ContainerItem dragParentItem=(ContainerItem)dragParentViewObj.getProperty().getItem();
    String newName=showPasteDlg(dragParentItem.getRepObjType(),dragParentItem,"String_Node_Str" + name);
    if (newName != null) {
      String pathStr=dropProp.getItem().getState().getPath();
      IPath path=new Path(pathStr);
      ERepositoryObjectType type=dropViewObj.getRepositoryObjectType();
      if (type == IServerObjectRepositoryType.TYPE_WORKFLOW) {
        EList refFiles=item.getReferenceResources();
        if (!refFiles.isEmpty()) {
          ReferenceFileItem refFileItem=(ReferenceFileItem)refFiles.get(0);
          byte[] content=refFileItem.getContent().getInnerContent();
          IFolder folder=RepositoryResourceUtil.getFolder(type);
          String fileName=refFileItem.getName().replace(name,newName);
          fileName=fileName.replace("String_Node_Str","String_Node_Str");
          IFile file=folder.getFile(fileName);
          InputStream inputStream=new ByteArrayInputStream(content);
          try {
            if (!file.exists())             file.create(new ByteArrayInputStream(content),IFile.FORCE,new NullProgressMonitor());
 else             file.setContents(new ByteArrayInputStream(content),IFile.FORCE,new NullProgressMonitor());
            file.refreshLocal(IResource.DEPTH_ZERO,new NullProgressMonitor());
            IMDMRepositoryEnterpriseServiceExt service=(IMDMRepositoryEnterpriseServiceExt)GlobalServiceRegister.getDefault().getService(IMDMRepositoryEnterpriseServiceExt.class);
            newName=newName.replace("String_Node_Str","String_Node_Str");
            if (service != null) {
              service.updateWorkflowContent(newName,fileName,inputStream,dragParentViewObj);
            }
            return true;
          }
 catch (          CoreException e) {
            log.error(e.getMessage(),e);
          }
        }
      }
 else {
        IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
        Item copy=null;
        try {
          copy=factory.copy(item,path,true);
          if (factory.isEditableAndLockIfPossible(copy)) {
            if (copy instanceof MDMServerObjectItem) {
              ((MDMServerObjectItem)copy).getMDMServerObject().setName(newName);
              ((MDMServerObjectItem)copy).getMDMServerObject().setLastServerDef(null);
              CommandManager.getInstance().pushCommand(ICommand.CMD_ADD,copy.getProperty().getId(),newName);
            }
            copy.getProperty().setLabel(newName);
            RepositoryResourceUtil.setLastServerDef(copy,null);
            factory.save(copy);
            return true;
          }
        }
 catch (        PersistenceException e) {
          log.error(e.getMessage(),e);
        }
catch (        BusinessException e) {
          log.error(e.getMessage(),e);
        }
 finally {
          try {
            factory.unlock(copy);
          }
 catch (          PersistenceException e) {
            log.error(e.getMessage(),e);
          }
catch (          LoginException e) {
            log.error(e.getMessage(),e);
          }
        }
      }
    }
  }
  return false;
}