Program: 147856
Project: 147856
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);
      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);
          }
          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);
      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;
}