nus-yam/ex-repair huggingface dataset:
Program: 147904
Project: 147904
Buggy source:
public void run(){
  try {
    if (treeEntry.getParentTreeEntry() == null) {
      WSMenu menu=((WSMenu)viewer.getInput());
      if (menu.getMenuEntries().length == 1) {
        MessageDialog.openWarning(MenuMainPage.this.getSite().getShell(),"String_Node_Str","String_Node_Str");
        return;
      }
      ArrayList<WSMenuEntry> subMenus=new ArrayList(Arrays.asList(menu.getMenuEntries()));
      subMenus.remove(treeEntry.getWsMenuEntry());
      menu.setMenuEntries(subMenus.toArray(new WSMenuEntry[subMenus.size()]));
    }
 else {
      ArrayList<WSMenuEntry> subMenus=new ArrayList(Arrays.asList(treeEntry.getParentTreeEntry().getWsMenuEntry().getSubMenus()));
      subMenus.remove(treeEntry.getWsMenuEntry());
      treeEntry.getParentTreeEntry().getWsMenuEntry().setSubMenus(subMenus.toArray(new WSMenuEntry[subMenus.size()]));
    }
    viewer.setExpandedState(treeEntry.getParentTreeEntry(),true);
    viewer.refresh(treeEntry.getParentTreeEntry(),false);
    markDirtyWithoutCommit();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(viewer.getControl().getShell(),"String_Node_Str","String_Node_Str" + treeEntry.getWsMenuEntry().getId() + "String_Node_Str"+ e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void run(){
  try {
    if (treeEntry.getParentTreeEntry() == null) {
      WSMenu menu=((WSMenu)viewer.getInput());
      if (menu.getMenuEntries().length == 1) {
        MessageDialog.openWarning(MenuMainPage.this.getSite().getShell(),"String_Node_Str","String_Node_Str");
        return;
      }
      ArrayList<WSMenuEntry> subMenus=new ArrayList(Arrays.asList(menu.getMenuEntries()));
      subMenus.remove(treeEntry.getWsMenuEntry());
      menu.setMenuEntries(subMenus.toArray(new WSMenuEntry[subMenus.size()]));
    }
 else {
      ArrayList<WSMenuEntry> subMenus=new ArrayList(Arrays.asList(treeEntry.getParentTreeEntry().getWsMenuEntry().getSubMenus()));
      subMenus.remove(treeEntry.getWsMenuEntry());
      treeEntry.getParentTreeEntry().getWsMenuEntry().setSubMenus(subMenus.toArray(new WSMenuEntry[subMenus.size()]));
    }
    if (treeEntry.getParentTreeEntry() != null) {
      viewer.setExpandedState(treeEntry.getParentTreeEntry(),true);
      viewer.refresh(treeEntry.getParentTreeEntry(),false);
    }
    viewer.refresh();
    markDirtyWithoutCommit();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(viewer.getControl().getShell(),"String_Node_Str","String_Node_Str" + treeEntry.getWsMenuEntry().getId() + "String_Node_Str"+ e.getLocalizedMessage());
  }
}
Program: 147906
Project: 147906
Buggy source:
public void modify(Object element,String property,Object value){
  TableItem item=(TableItem)element;
  if (Pattern.compile("String_Node_Str").matcher(value.toString()).matches() || value.toString().trim().replaceAll("String_Node_Str","String_Node_Str").length() != value.toString().trim().length()) {
    MessageDialog.openInformation(null,"String_Node_Str","String_Node_Str");
    return;
  }
  XSDElementDeclaration elem=(XSDElementDeclaration)item.getData();
  if (!(BROWSE_ITEMS + elem.getName()).equals(value.toString().trim())) {
    for (    XSDElementDeclaration theElem : declList) {
      if (theElem == elem)       continue;
      if ((BROWSE_ITEMS + theElem.getName()).equals(value.toString().trim())) {
        MessageDialog.openInformation(null,"String_Node_Str","String_Node_Str");
        return;
      }
    }
    List<Line> lines=browseItemToRoles.get(BROWSE_ITEMS + elem.getName());
    browseItemToRoles.remove(BROWSE_ITEMS + elem.getName());
    int prex=value.toString().trim().indexOf(BROWSE_ITEMS);
    elem.setName(value.toString().trim().substring(prex + BROWSE_ITEMS.length()));
    browseItemToRoles.put(value.toString().trim(),lines);
    refreshRoleView(BROWSE_ITEMS + elem.getName());
    browseViewer.update(elem,null);
  }
}

Fixed version (ground truth):
public void modify(Object element,String property,Object value){
  TableItem item=(TableItem)element;
  if (Pattern.compile("String_Node_Str").matcher(value.toString()).matches() || value.toString().trim().replaceAll("String_Node_Str","String_Node_Str").length() != value.toString().trim().length()) {
    MessageDialog.openInformation(null,"String_Node_Str","String_Node_Str");
    return;
  }
  XSDElementDeclaration elem=(XSDElementDeclaration)item.getData();
  if (!(BROWSE_ITEMS + elem.getName()).equals(value.toString().trim())) {
    for (    XSDElementDeclaration theElem : declList) {
      if (theElem == elem)       continue;
      if ((BROWSE_ITEMS + theElem.getName()).equals(value.toString().trim())) {
        MessageDialog.openInformation(null,"String_Node_Str","String_Node_Str");
        return;
      }
    }
    List<Line> lines=browseItemToRoles.get(BROWSE_ITEMS + elem.getName());
    browseItemToRoles.remove(BROWSE_ITEMS + elem.getName());
    int prex=value.toString().trim().indexOf(BROWSE_ITEMS);
    if ((prex + BROWSE_ITEMS.length()) <= value.toString().trim().length())     elem.setName(value.toString().trim().substring(prex + BROWSE_ITEMS.length()));
    browseItemToRoles.put(value.toString().trim(),lines);
    refreshRoleView(BROWSE_ITEMS + elem.getName());
    browseViewer.update(elem,null);
  }
}
Program: 147907
Project: 147907
Buggy source:
protected void linkReferenceFile(Item item,IFile file){
  try {
    file.refreshLocal(0,null);
    ReferenceFileItem procFileItem=PropertiesFactory.eINSTANCE.createReferenceFileItem();
    ByteArray byteArray=PropertiesFactory.eINSTANCE.createByteArray();
    byteArray.setInnerContentFromFile(file);
    procFileItem.setContent(byteArray);
    procFileItem.setExtension(file.getFileExtension());
    procFileItem.setName(file.getName());
    item.getReferenceResources().clear();
    item.getReferenceResources().add(procFileItem);
  }
 catch (  IOException e) {
    log.error(e.getMessage(),e);
  }
catch (  CoreException e) {
    log.error(e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void linkReferenceFile(Item item,IFile file){
  try {
    file.refreshLocal(0,null);
    ReferenceFileItem fileItem=findReferenceFileItem(item,file);
    if (fileItem != null) {
      fileItem.getContent().setInnerContentFromFile(file);
    }
 else {
      ReferenceFileItem procFileItem=PropertiesFactory.eINSTANCE.createReferenceFileItem();
      ByteArray byteArray=PropertiesFactory.eINSTANCE.createByteArray();
      byteArray.setInnerContentFromFile(file);
      procFileItem.setContent(byteArray);
      procFileItem.setExtension(file.getFileExtension());
      procFileItem.setName(file.getName());
      item.getReferenceResources().clear();
      item.getReferenceResources().add(procFileItem);
    }
  }
 catch (  IOException e) {
    log.error(e.getMessage(),e);
  }
catch (  CoreException e) {
    log.error(e.getMessage(),e);
  }
}
Program: 147908
Project: 147908
Buggy source:
private boolean isExist(TreeObject treeObj){
  List<IRepositoryViewObject> children=getRelatedChildren(treeObj.getType());
  if (children == null)   return false;
  for (  IRepositoryViewObject viewObject : children) {
    Item item=viewObject.getProperty().getItem();
    MDMServerObject serverObj=((MDMServerObjectItem)item).getMDMServerObject();
    if (serverObj != null && treeObj.getName().equals(serverObj.getName())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean isExist(TreeObject treeObj){
  if (treeObj instanceof TreeParent) {
    return false;
  }
  int type=treeObj.getType();
  ERepositoryObjectType rType=RepositoryQueryService.getRepositoryObjectType(type);
  if (rType == null) {
    return false;
  }
  List<IRepositoryViewObject> children=RepositoryResourceUtil.findAllViewObjectsWithDeleted(rType);
  if (children == null)   return false;
  String treeObjName=treeObj.getName();
  if (type == TreeObject.PICTURES_RESOURCE) {
    int index=treeObjName.indexOf("String_Node_Str");
    if (index > 0) {
      treeObjName=treeObjName.substring(index + 1);
    }
  }
  for (  IRepositoryViewObject viewObject : children) {
    Item item=viewObject.getProperty().getItem();
    if (item instanceof MDMServerObjectItem) {
      MDMServerObject serverObj=((MDMServerObjectItem)item).getMDMServerObject();
      String name=serverObj.getName();
      if (type == TreeObject.WORKFLOW_PROCESS) {
        name=name + "String_Node_Str" + viewObject.getVersion();
      }
      if (type == TreeObject.PICTURES_RESOURCE) {
        name=name + "String_Node_Str" + viewObject.getVersion()+ "String_Node_Str"+ ((WSResourceE)serverObj).getFileExtension();
      }
      if (serverObj != null && treeObjName.equals(name)) {
        return true;
      }
    }
  }
  return false;
}
Program: 147909
Project: 147909
Buggy source:
public static void setImporting(boolean importing){
  ImportService.importing=importing;
}

Fixed version (ground truth):
public synchronized static void setImporting(boolean importing){
  ImportService.importing=importing;
}
Program: 147910
Project: 147910
Buggy source:
public static boolean isImporting(){
  return importing;
}

Fixed version (ground truth):
public synchronized static boolean isImporting(){
  return importing;
}
Program: 147911
Project: 147911
Buggy source:
public void handleEvent(Event event){
  if (event.button == DOMViewDialog.BUTTON_SAVE) {
    try {
      final XtentisPort port=Util.getPort(getXObject());
      WSPutItemWithReport item=new WSPutItemWithReport(new WSPutItem((WSDataClusterPK)getXObject().getWsKey(),d.getXML(),"String_Node_Str".equals(d.getDataModelName()) ? null : new WSDataModelPK(d.getDataModelName()),false),"String_Node_Str",d.isTriggerProcess());
      port.putItemWithReport(item);
    }
 catch (    Exception e) {
      MessageDialog.openError(shell,"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
      return;
    }
  }
  d.close();
}

Fixed version (ground truth):
public void handleEvent(Event event){
  if (event.button == DOMViewDialog.BUTTON_SAVE) {
    try {
      final XtentisPort port=Util.getPort(getXObject());
      WSPutItemWithReport item=new WSPutItemWithReport(new WSPutItem((WSDataClusterPK)getXObject().getWsKey(),d.getXML(),"String_Node_Str".equals(d.getDataModelName()) ? null : new WSDataModelPK(d.getDataModelName()),false),"String_Node_Str",d.isTriggerProcess());
      port.putItemWithReport(item);
      doSearch();
    }
 catch (    Exception e) {
      MessageDialog.openError(shell,"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
      return;
    }
  }
  d.close();
}
Program: 147912
Project: 147912
Buggy source:
public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  return false;
}

Fixed version (ground truth):
public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  return true;
}
Program: 147913
Project: 147913
Buggy source:
public boolean remove(AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  IRepositoryViewObject viewObj=cmd.getViewObject();
  Item item=viewObj.getProperty().getItem();
  MDMServerObject serverObject=((MDMServerObjectItem)item).getMDMServerObject();
  Object wsObj=convert(item,serverObject);
  XtentisPort port=getPort(cmd.getServerDef());
  return doRemove(port,wsObj);
}

Fixed version (ground truth):
public boolean remove(AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  XtentisPort port=getPort(cmd.getServerDef());
  return doRemove(port,cmd);
}
Program: 147914
Project: 147914
Buggy source:
public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  if (wsObj != null) {
    WSCustomForm wsForm=(WSCustomForm)wsObj;
    port.deleteCustomForm(new WSDeleteCustomForm(new WSCustomFormPK(wsForm.getDatamodel(),wsForm.getEntity(),wsForm.getName())));
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  IRepositoryViewObject viewObj=cmd.getViewObject();
  Item item=viewObj.getProperty().getItem();
  MDMServerObject serverObject=((MDMServerObjectItem)item).getMDMServerObject();
  Object wsObj=convert(item,serverObject);
  if (wsObj != null) {
    WSCustomForm wsForm=(WSCustomForm)wsObj;
    port.deleteCustomForm(new WSDeleteCustomForm(new WSCustomFormPK(wsForm.getDatamodel(),wsForm.getEntity(),cmd.getObjName())));
    return true;
  }
  return false;
}
Program: 147915
Project: 147915
Buggy source:
@Override public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSDataClusterPK pk=new WSDataClusterPK();
  String name=((WSDataCluster)wsObj).getName();
  pk.setPk(name);
  port.deleteDataCluster(new WSDeleteDataCluster(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.DataCluster.getName());
  return true;
}

Fixed version (ground truth):
@Override public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSDataClusterPK pk=new WSDataClusterPK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteDataCluster(new WSDeleteDataCluster(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.DataCluster.getName());
  return true;
}
Program: 147916
Project: 147916
Buggy source:
@Override public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSDataModelPK pk=new WSDataModelPK();
  String name=((WSDataModel)wsObj).getName();
  pk.setPk(name);
  port.deleteDataModel(new WSDeleteDataModel(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.DataMODEL.getName());
  return true;
}

Fixed version (ground truth):
@Override public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSDataModelPK pk=new WSDataModelPK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteDataModel(new WSDeleteDataModel(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.DataMODEL.getName());
  return true;
}
Program: 147917
Project: 147917
Buggy source:
@Override public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSMenuPK pk=new WSMenuPK();
  String name=((WSMenu)wsObj).getName();
  pk.setPk(name);
  port.deleteMenu(new WSDeleteMenu(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Menu.getName());
  return true;
}

Fixed version (ground truth):
@Override public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSMenuPK pk=new WSMenuPK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteMenu(new WSDeleteMenu(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Menu.getName());
  return true;
}
Program: 147918
Project: 147918
Buggy source:
@Override public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSRolePK pk=new WSRolePK();
  String name=((WSRole)wsObj).getName();
  pk.setPk(name);
  port.deleteRole(new WSDeleteRole(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Role.getName());
  return true;
}

Fixed version (ground truth):
@Override public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSRolePK pk=new WSRolePK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteRole(new WSDeleteRole(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Role.getName());
  return true;
}
Program: 147919
Project: 147919
Buggy source:
@Override public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSRoutingRulePK pk=new WSRoutingRulePK();
  String name=((WSRoutingRule)wsObj).getName();
  pk.setPk(name);
  port.deleteRoutingRule(new WSDeleteRoutingRule(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.RoutingRule.getName());
  return true;
}

Fixed version (ground truth):
@Override public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSRoutingRulePK pk=new WSRoutingRulePK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteRoutingRule(new WSDeleteRoutingRule(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.RoutingRule.getName());
  return true;
}
Program: 147920
Project: 147920
Buggy source:
public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSStoredProcedurePK pk=new WSStoredProcedurePK();
  String name=((WSStoredProcedure)wsObj).getName();
  pk.setPk(name);
  port.deleteStoredProcedure(new WSDeleteStoredProcedure(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.StoredProcedure.getName());
  return true;
}

Fixed version (ground truth):
public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSStoredProcedurePK pk=new WSStoredProcedurePK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteStoredProcedure(new WSDeleteStoredProcedure(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.StoredProcedure.getName());
  return true;
}
Program: 147921
Project: 147921
Buggy source:
public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSSynchronizationPlanPK pk=new WSSynchronizationPlanPK();
  String name=((WSSynchronizationPlan)wsObj).getName();
  pk.setPk(name);
  port.deleteSynchronizationPlan(new WSDeleteSynchronizationPlan(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.SynchronizationPlan.getName());
  return true;
}

Fixed version (ground truth):
public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSSynchronizationPlanPK pk=new WSSynchronizationPlanPK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteSynchronizationPlan(new WSDeleteSynchronizationPlan(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.SynchronizationPlan.getName());
  return true;
}
Program: 147922
Project: 147922
Buggy source:
public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSTransformerV2PK pk=new WSTransformerV2PK();
  String name=((WSTransformerV2)wsObj).getName();
  pk.setPk(name);
  port.deleteTransformerV2(new WSDeleteTransformerV2(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Transformer.getName());
  return true;
}

Fixed version (ground truth):
public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSTransformerV2PK pk=new WSTransformerV2PK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteTransformerV2(new WSDeleteTransformerV2(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Transformer.getName());
  return true;
}
Program: 147923
Project: 147923
Buggy source:
public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSUniversePK pk=new WSUniversePK();
  String name=((WSUniverse)wsObj).getName();
  pk.setPk(name);
  port.deleteUniverse(new WSDeleteUniverse(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Universe.getName());
  return true;
}

Fixed version (ground truth):
public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSUniversePK pk=new WSUniversePK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteUniverse(new WSDeleteUniverse(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.Universe.getName());
  return true;
}
Program: 147924
Project: 147924
Buggy source:
public boolean doRemove(XtentisPort port,Object wsObj) throws RemoteException {
  WSViewPK pk=new WSViewPK();
  String name=((WSView)wsObj).getName();
  pk.setPk(name);
  port.deleteView(new WSDeleteView(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.View.getName());
  return true;
}

Fixed version (ground truth):
public boolean doRemove(XtentisPort port,AbstractDeployCommand cmd) throws RemoteException, XtentisException {
  WSViewPK pk=new WSViewPK();
  String name=cmd.getObjName();
  pk.setPk(name);
  port.deleteView(new WSDeleteView(pk));
  TreeObjectUtil.deleteSpecificationFromAttachedRole(port,name,EXtentisObjects.View.getName());
  return true;
}
Program: 147925
Project: 147925
Buggy source:
public void restoreState(IMemento aMemento){
  commandId=aMemento.getString(PROP_ID);
  this.objName=aMemento.getString(PROP_OBJ_NAME);
  this.lastName=aMemento.getString(PROP_LAST_OBJ_NAME);
}

Fixed version (ground truth):
public void restoreState(IMemento aMemento){
  commandId=aMemento.getString(PROP_ID);
  this.objName=aMemento.getString(PROP_OBJ_NAME);
  this.lastName=aMemento.getString(PROP_LAST_OBJ_NAME);
  Integer phaseObj=aMemento.getInteger(PROP_PHASE);
  if (phaseObj != null) {
    runPhase=phaseObj.intValue();
  }
}
Program: 147926
Project: 147926
Buggy source:
public void saveState(IMemento aMemento){
  aMemento.putString(PROP_ID,commandId);
  aMemento.putInteger(PROP_TYPE,getCommandType());
  aMemento.putString(PROP_OBJ_NAME,objName);
  aMemento.putString(PROP_LAST_OBJ_NAME,lastName);
}

Fixed version (ground truth):
public void saveState(IMemento aMemento){
  aMemento.putString(PROP_ID,commandId);
  aMemento.putInteger(PROP_TYPE,getCommandType());
  aMemento.putString(PROP_OBJ_NAME,objName);
  aMemento.putString(PROP_LAST_OBJ_NAME,lastName);
  aMemento.putInteger(PROP_PHASE,getToRunPhase());
}
Program: 147927
Project: 147927
Buggy source:
public List<AbstractDeployCommand> getAllDeployCommands(){
  List<AbstractDeployCommand> cmds=new ArrayList<AbstractDeployCommand>();
  for (  CommandStack stack : map.values()) {
    ICommand validCommand=stack.getValidCommand();
    if (validCommand != null) {
      if (validCommand instanceof AbstractDeployCommand) {
        fillViewObjectToCommand(validCommand);
        AbstractDeployCommand deployCommand=(AbstractDeployCommand)validCommand;
        cmds.add(deployCommand);
      }
    }
  }
  return cmds;
}

Fixed version (ground truth):
public List<AbstractDeployCommand> getAllDeployCommands(){
  List<AbstractDeployCommand> cmds=new ArrayList<AbstractDeployCommand>();
  for (  CommandStack stack : map.values()) {
    ICommand validCommand=stack.getValidDeployCommand();
    if (validCommand != null) {
      if (validCommand instanceof AbstractDeployCommand) {
        fillViewObjectToCommand(validCommand);
        AbstractDeployCommand deployCommand=(AbstractDeployCommand)validCommand;
        cmds.add(deployCommand);
      }
    }
  }
  return cmds;
}
Program: 147928
Project: 147928
Buggy source:
public void removeCommandStack(String id){
  if (id == null)   return;
  map.remove(id);
}

Fixed version (ground truth):
public void removeCommandStack(String id,int phase){
  if (id == null)   return;
  CommandStack stack=map.get(id);
  if (stack != null) {
    stack.removeCommandsByPhase(phase);
    if (stack.isEmpty()) {
      map.remove(id);
    }
  }
}
Program: 147929
Project: 147929
Buggy source:
private void pushCommand(ICommand command){
  CommandStack commandStack=map.get(command.getCommandId());
  if (commandStack == null) {
    commandStack=new CommandStack();
    if (commandStack.pushCommand(command)) {
      map.put(command.getCommandId(),commandStack);
    }
  }
 else {
    commandStack.pushCommand(command);
  }
}

Fixed version (ground truth):
public void pushCommand(ICommand command){
  CommandStack commandStack=map.get(command.getCommandId());
  if (commandStack == null) {
    commandStack=new CommandStack();
    if (commandStack.pushCommand(command)) {
      map.put(command.getCommandId(),commandStack);
    }
  }
 else {
    commandStack.pushCommand(command);
  }
}
Program: 147930
Project: 147930
Buggy source:
/** 
 * DOC hbhong Comment method "getDeployCommands".
 * @param viewObjs
 * @param defaultCmdType if none then assign -1
 * @return
 */
public List<AbstractDeployCommand> getDeployCommands(List<IRepositoryViewObject> viewObjs,int defaultCmdType){
  List<AbstractDeployCommand> cmds=new LinkedList<AbstractDeployCommand>();
  for (  IRepositoryViewObject viewObj : viewObjs) {
    CommandStack stack=findCommandStack(viewObj.getId());
    if (stack == null) {
      stack=new CommandStack();
      ICommand cmd=getNewCommand(ICommand.CMD_MODIFY);
      cmd.init(viewObj);
      stack.pushCommand(cmd);
    }
    ICommand validCommand=stack.getValidCommand();
    if (validCommand != null) {
      if (validCommand instanceof AbstractDeployCommand) {
        fillViewObjectToCommand(validCommand);
        AbstractDeployCommand deployCommand=(AbstractDeployCommand)validCommand;
        cmds.add(deployCommand);
      }
 else       if (validCommand instanceof NOPCommand && defaultCmdType > 0) {
        ICommand cmd=getNewCommand(defaultCmdType);
        if (cmd instanceof AbstractDeployCommand) {
          cmd.init(viewObj);
          cmds.add((AbstractDeployCommand)cmd);
        }
      }
    }
  }
  return cmds;
}

Fixed version (ground truth):
/** 
 * DOC hbhong Comment method "getDeployCommands".
 * @param viewObjs
 * @param defaultCmdType if none then assign -1
 * @return
 */
public List<AbstractDeployCommand> getDeployCommands(List<IRepositoryViewObject> viewObjs,int defaultCmdType){
  List<AbstractDeployCommand> cmds=new LinkedList<AbstractDeployCommand>();
  for (  IRepositoryViewObject viewObj : viewObjs) {
    CommandStack stack=findCommandStack(viewObj.getId());
    if (stack == null) {
      stack=new CommandStack();
      ICommand cmd=getNewCommand(ICommand.CMD_MODIFY);
      cmd.init(viewObj);
      stack.pushCommand(cmd);
    }
    ICommand validCommand=stack.getValidDeployCommand();
    if (validCommand != null) {
      if (validCommand instanceof AbstractDeployCommand) {
        fillViewObjectToCommand(validCommand);
        AbstractDeployCommand deployCommand=(AbstractDeployCommand)validCommand;
        cmds.add(deployCommand);
      }
 else       if (validCommand instanceof NOPCommand && defaultCmdType > 0) {
        ICommand cmd=getNewCommand(defaultCmdType);
        if (cmd instanceof AbstractDeployCommand) {
          cmd.init(viewObj);
          cmds.add((AbstractDeployCommand)cmd);
        }
      }
    }
  }
  return cmds;
}
Program: 147931
Project: 147931
Buggy source:
public ICommand getNewCommand(int type){
switch (type) {
case ICommand.CMD_NOP:
    return new NOPCommand();
case ICommand.CMD_ADD:
  return new AddCommand();
case ICommand.CMD_DELETE:
return new DeleteCommand();
case ICommand.CMD_MODIFY:
return new ModifyCommand();
case ICommand.CMD_RENAME:
return new RenameCommand();
case ICommand.CMD_RESTORE:
return new RestoreCommand();
}
return null;
}

Fixed version (ground truth):
public ICommand getNewCommand(int type){
switch (type) {
case ICommand.CMD_NOP:
    return new NOPCommand();
case ICommand.CMD_ADD:
  return new AddCommand();
case ICommand.CMD_DELETE:
return new DeleteCommand();
case ICommand.CMD_MODIFY:
return new ModifyCommand();
case ICommand.CMD_RENAME:
return new RenameCommand();
case ICommand.CMD_RESTORE:
return new RestoreCommand();
case ICommand.CMD_UPDATE_SERVER:
return new UpdateLastServerCommand();
case ICommand.CMD_PUSH_COMMAND:
return new PushCmdCommand();
}
return null;
}
Program: 147932
Project: 147932
Buggy source:
public void restoreState(IMemento aMemento){
  IMemento[] children=aMemento.getChildren(ICommand.MEM_TYPE_COMMAND);
  if (children != null) {
    commands.clear();
    for (    IMemento childMem : children) {
      ICommand cmd=manager.restoreCommand(childMem);
      if (cmd != null) {
        pushCommand(cmd,false);
      }
    }
    calValidCommand();
  }
}

Fixed version (ground truth):
public void restoreState(IMemento aMemento){
  IMemento[] children=aMemento.getChildren(ICommand.MEM_TYPE_COMMAND);
  if (children != null) {
    commands.clear();
    for (    IMemento childMem : children) {
      ICommand cmd=manager.restoreCommand(childMem);
      if (cmd != null) {
        pushCommand(cmd,false);
      }
    }
    calValidDeployCommand();
  }
}
Program: 147933
Project: 147933
Buggy source:
public boolean pushCommand(ICommand cmd,boolean updateValidCmd){
  if (commands.isEmpty()) {
    if (cmd.getCommandType() == ICommand.CMD_RESTORE) {
      return false;
    }
    commands.add(cmd);
    cmdId=cmd.getCommandId();
    if (updateValidCmd) {
      calValidCommand();
    }
    return true;
  }
  String commandId=cmd.getCommandId();
  if (commandId != null && commandId.equals(cmdId)) {
    commands.add(cmd);
    if (updateValidCmd) {
      calValidCommand();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean pushCommand(ICommand cmd,boolean updateValidCmd){
  if (commands.isEmpty()) {
    if (cmd.getCommandType() == ICommand.CMD_RESTORE) {
      return false;
    }
    commands.add(cmd);
    cmdId=cmd.getCommandId();
    if (updateValidCmd) {
      calValidDeployCommand();
    }
    return true;
  }
  String commandId=cmd.getCommandId();
  if (commandId != null && commandId.equals(cmdId)) {
    commands.add(cmd);
    if (updateValidCmd) {
      calValidDeployCommand();
    }
    return true;
  }
  return false;
}
Program: 147934
Project: 147934
Buggy source:
protected void createTreeViewer(Composite itemComposite){
  filteredCheckboxTree=new FilteredCheckboxTree(itemComposite,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI){
    ContainerCheckedTreeViewer treeViewer;
    @Override protected CheckboxTreeViewer doCreateTreeViewer(    Composite parent,    int style){
      IRepositoryViewObject[] categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
      treeViewer=new ContainerCheckedTreeViewer(parent);
      treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
      treeViewer.setContentProvider(new CommonMDMRepositoryContentProvider());
      treeViewer.setInput(categoryViewObjects);
      return treeViewer;
    }
    @Override protected void refreshCompleted(){
      treeViewer.expandToLevel(3);
      restoreCheckedElements();
    }
    @Override protected boolean isNodeCollectable(    TreeItem item){
      return false;
    }
  }
;
}

Fixed version (ground truth):
protected void createTreeViewer(Composite itemComposite){
  filteredCheckboxTree=new FilteredCheckboxTree(itemComposite,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI){
    ContainerCheckedTreeViewer treeViewer;
    @Override protected CheckboxTreeViewer doCreateTreeViewer(    Composite parent,    int style){
      IRepositoryViewObject[] categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
      treeViewer=new ContainerCheckedTreeViewer(parent);
      treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
      treeViewer.setContentProvider(new MDMRepositoryContentProvider());
      treeViewer.setInput(categoryViewObjects);
      return treeViewer;
    }
    @Override protected void refreshCompleted(){
      treeViewer.expandToLevel(3);
      restoreCheckedElements();
    }
    @Override protected boolean isNodeCollectable(    TreeItem item){
      return false;
    }
  }
;
}
Program: 147935
Project: 147935
Buggy source:
@Override protected CheckboxTreeViewer doCreateTreeViewer(Composite parent,int style){
  IRepositoryViewObject[] categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
  treeViewer=new ContainerCheckedTreeViewer(parent);
  treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
  treeViewer.setContentProvider(new CommonMDMRepositoryContentProvider());
  treeViewer.setInput(categoryViewObjects);
  return treeViewer;
}

Fixed version (ground truth):
@Override protected CheckboxTreeViewer doCreateTreeViewer(Composite parent,int style){
  IRepositoryViewObject[] categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
  treeViewer=new ContainerCheckedTreeViewer(parent);
  treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
  treeViewer.setContentProvider(new MDMRepositoryContentProvider());
  treeViewer.setInput(categoryViewObjects);
  return treeViewer;
}
Program: 147936
Project: 147936
Buggy source:
protected Composite initItemTreeViewer(Composite composite){
  Composite returnComposite=checkTreeViewer.createItemList(composite);
  checkTreeViewer.setItemText(Messages.MDMExportRepositoryItemsWizard_exportItem);
  return returnComposite;
}

Fixed version (ground truth):
protected Composite initItemTreeViewer(Composite composite){
  Composite returnComposite=checkTreeViewer.createItemList(composite);
  checkTreeViewer.setItemText(Messages.MDMExportRepositoryItemsWizard_exportItem);
  checkTreeViewer.getViewer().expandAll();
  ((CheckboxTreeViewer)checkTreeViewer.getViewer()).expandToLevel(2);
  return returnComposite;
}
Program: 147937
Project: 147937
Buggy source:
/** 
 * DOC hbhong RepositoryObjectCheckTreeViewer constructor comment.
 * @param selection
 */
public ExportRepositoryObjectCheckTreeViewer(IStructuredSelection selection){
  super(selection);
}

Fixed version (ground truth):
public ExportRepositoryObjectCheckTreeViewer(IStructuredSelection selection){
  super(selection);
}
Program: 147938
Project: 147938
Buggy source:
protected void createTreeViewer(Composite itemComposite){
  filteredCheckboxTree=new FilteredCheckboxTree(itemComposite,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI){
    ContainerCheckedTreeViewer treeViewer;
    @Override protected CheckboxTreeViewer doCreateTreeViewer(    Composite parent,    int style){
      IRepositoryViewObject[] categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
      treeViewer=new ContainerCheckedTreeViewer(parent);
      treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
      treeViewer.setContentProvider(new MDMRepositoryContentProvider());
      treeViewer.setInput(categoryViewObjects);
      return treeViewer;
    }
    @Override protected void refreshCompleted(){
      treeViewer.expandToLevel(3);
      restoreCheckedElements();
    }
    @Override protected boolean isNodeCollectable(    TreeItem item){
      return false;
    }
  }
;
}

Fixed version (ground truth):
protected void createTreeViewer(Composite itemComposite){
  filteredCheckboxTree=new FilteredCheckboxTree(itemComposite,SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL| SWT.MULTI){
    ContainerCheckedTreeViewer treeViewer;
    @Override protected CheckboxTreeViewer doCreateTreeViewer(    Composite parent,    int style){
      categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
      IRepositoryViewObject[] viewObjs=getSortedViewObjects(categoryViewObjects);
      treeViewer=new ContainerCheckedTreeViewer(parent);
      treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
      treeViewer.setContentProvider(new MDMRepositoryContentProvider());
      treeViewer.setInput(viewObjs);
      return treeViewer;
    }
    @Override protected void refreshCompleted(){
      treeViewer.expandToLevel(3);
      restoreCheckedElements();
    }
    @Override protected boolean isNodeCollectable(    TreeItem item){
      return false;
    }
  }
;
}
Program: 147939
Project: 147939
Buggy source:
@Override protected CheckboxTreeViewer doCreateTreeViewer(Composite parent,int style){
  IRepositoryViewObject[] categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
  treeViewer=new ContainerCheckedTreeViewer(parent);
  treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
  treeViewer.setContentProvider(new MDMRepositoryContentProvider());
  treeViewer.setInput(categoryViewObjects);
  return treeViewer;
}

Fixed version (ground truth):
@Override protected CheckboxTreeViewer doCreateTreeViewer(Composite parent,int style){
  categoryViewObjects=RepositoryResourceUtil.getCategoryViewObjects();
  IRepositoryViewObject[] viewObjs=getSortedViewObjects(categoryViewObjects);
  treeViewer=new ContainerCheckedTreeViewer(parent);
  treeViewer.setLabelProvider(new MDMRepositoryLabelProvider());
  treeViewer.setContentProvider(new MDMRepositoryContentProvider());
  treeViewer.setInput(viewObjs);
  return treeViewer;
}
Program: 147940
Project: 147940
Buggy source:
public ViewMainPage(FormEditor editor){
  super(editor,ViewMainPage.class.getName(),"String_Node_Str" + ((XObjectEditorInput)editor.getEditorInput()).getName() + Util.getRevision((TreeObject)((XObjectEditorInput)editor.getEditorInput()).getModel()));
  this.viewName=((XObjectEditorInput)editor.getEditorInput()).getName();
}

Fixed version (ground truth):
public ViewMainPage(FormEditor editor){
  super(editor,ViewMainPage.class.getName(),"String_Node_Str" + ((XObjectEditorInput)editor.getEditorInput()).getName() + Util.getRevision((TreeObject)((XObjectEditorInput)editor.getEditorInput()).getModel()));
  Object model=((XObjectEditorInput)editor.getEditorInput()).getModel();
  this.viewName=((TreeObject)model).getName();
}
Program: 147941
Project: 147941
Buggy source:
public String[] getGlobalInfos(){
  if (propSection.getTreeObject() == null)   return new String[0];
  if (propSection.getTreeObject().getServerRoot() == null && typeCode == TreeObject.ROLE) {
    return MDMRepositoryViewExtensionService.findAllRoleNames().toArray(new String[0]);
  }
  return Util.getChildren(propSection.getTreeObject().getServerRoot(),typeCode).toArray(new String[0]);
}

Fixed version (ground truth):
public String[] getGlobalInfos(){
  if (propSection.getTreeObject() == null)   return new String[0];
  if (propSection.getTreeObject().getServerRoot() == null) {
    if (typeCode == TreeObject.ROLE)     return MDMRepositoryViewExtensionService.findAllRoleNames().toArray(new String[0]);
    if (typeCode == TreeObject.WORKFLOW_PROCESS)     return MDMRepositoryViewExtensionService.findAllWorkflowNames().toArray(new String[0]);
  }
  return Util.getChildren(propSection.getTreeObject().getServerRoot(),typeCode).toArray(new String[0]);
}
Program: 147942
Project: 147942
Buggy source:
public static List<String> findAllRoleNames(){
  IExtensionRegistry registry=Platform.getExtensionRegistry();
  IExtensionPoint extensionPoint=registry.getExtensionPoint(PLUGIN,EXTENSION_POINT);
  if (extensionPoint != null && extensionPoint.isValid()) {
    IExtension[] extensions=extensionPoint.getExtensions();
    for (    IExtension s : extensions) {
      IConfigurationElement[] elements=s.getConfigurationElements();
      for (      IConfigurationElement element : elements) {
        if (element.getAttribute(PROP_CLASS) != null) {
          try {
            IMDMRepositoryViewServiceExt repositoryViewService=(IMDMRepositoryViewServiceExt)element.createExecutableExtension(PROP_CLASS);
            return repositoryViewService.findAllRoleNames();
          }
 catch (          Exception e) {
            log.error(e.getMessage(),e);
            return null;
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static List<String> findAllRoleNames(){
  IMDMRepositoryViewServiceExt service=getRepositoryViewService();
  if (service != null)   return service.findAllRoleNames();
 else   return null;
}
Program: 147943
Project: 147943
Buggy source:
public void stepUp(TreeViewer targetTreeViewer){
  TreeItem item;
  TreeItem[] items=targetTreeViewer.getTree().getSelection();
  for (int i=0; i < items.length; i++) {
    item=items[i];
    if (!(item.getData() instanceof XSDConcreteComponent))     continue;
    XSDConcreteComponent component=(XSDConcreteComponent)item.getData();
    if (!(component instanceof XSDParticle))     continue;
 else {
      XSDParticle particle=(XSDParticle)component;
      if (particle.getContainer() instanceof XSDModelGroup) {
        XSDModelGroup mp=(XSDModelGroup)particle.getContainer();
        int index=mp.getContents().indexOf(particle);
        if (index > 0) {
          mp.getContents().move(index - 1,index);
          this.refresh();
        }
      }
    }
  }
  this.markDirtyWithoutCommit();
}

Fixed version (ground truth):
public void stepUp(TreeViewer targetTreeViewer){
  TreeItem item;
  TreeItem[] items=targetTreeViewer.getTree().getSelection();
  boolean isDirty=false;
  for (int i=0; i < items.length; i++) {
    item=items[i];
    Object data=item.getData();
    EList content=getXSDComponentContainer(data);
    if (content != null) {
      int index=content.indexOf(data);
      if (index > 0) {
        content.move(index - 1,index);
        isDirty=true;
        this.refresh();
      }
    }
  }
  if (isDirty)   this.markDirtyWithoutCommit();
}
Program: 147944
Project: 147944
Buggy source:
public void stepDown(TreeViewer targetTreeViewer){
  TreeItem item;
  TreeItem[] items=targetTreeViewer.getTree().getSelection();
  for (int i=items.length - 1; i >= 0; i--) {
    item=items[i];
    if (!(item.getData() instanceof XSDConcreteComponent))     continue;
    XSDConcreteComponent component=(XSDConcreteComponent)item.getData();
    if (!(component instanceof XSDParticle))     continue;
 else {
      XSDParticle particle=(XSDParticle)component;
      if (particle.getContainer() instanceof XSDModelGroup) {
        XSDModelGroup mp=(XSDModelGroup)particle.getContainer();
        int index=mp.getContents().indexOf(particle);
        if (index < mp.getContents().size() - 1) {
          mp.getContents().move(index,index + 1);
          this.refresh();
        }
      }
    }
  }
  this.markDirtyWithoutCommit();
}

Fixed version (ground truth):
public void stepDown(TreeViewer targetTreeViewer){
  TreeItem item;
  TreeItem[] items=targetTreeViewer.getTree().getSelection();
  boolean isDirty=false;
  for (int i=items.length - 1; i >= 0; i--) {
    item=items[i];
    Object data=item.getData();
    EList content=getXSDComponentContainer(data);
    if (content != null) {
      int index=content.indexOf(data);
      if (index < content.size() - 1) {
        content.move(index,index + 1);
        this.refresh();
      }
    }
  }
  if (isDirty)   this.markDirtyWithoutCommit();
}
Program: 147945
Project: 147945
Buggy source:
@Override public void initCommonViewer(CommonViewer commonViewer){
  super.initCommonViewer(commonViewer);
  addAction=new NewDataContainerAction();
  addAction.initCommonViewer(commonViewer);
}

Fixed version (ground truth):
@Override public void initCommonViewer(CommonViewer commonViewer){
  super.initCommonViewer(commonViewer);
  addAction=initRepositoryAction(new NewDataContainerAction(),commonViewer);
  exportDataClusterAction=initRepositoryAction(new ExportDataClusterAction(),commonViewer);
}
Program: 147946
Project: 147946
Buggy source:
@Override public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj){
  List<AbstractRepositoryAction> actions=super.getActions(viewObj);
  if (RepositoryResourceUtil.hasContainerItem(viewObj,FolderType.SYSTEM_FOLDER_LITERAL,FolderType.FOLDER_LITERAL)) {
    actions.add(addAction);
  }
  if (viewObj.getProperty().getItem() instanceof MDMServerObjectItem) {
    actions.add(renameAction);
    actions.add(deployToAction);
    addAction(actions,deployToLastServerAction,viewObj);
  }
  actions.add(deployAllAction);
  return actions;
}

Fixed version (ground truth):
@Override public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj){
  List<AbstractRepositoryAction> actions=super.getActions(viewObj);
  if (RepositoryResourceUtil.hasContainerItem(viewObj,FolderType.SYSTEM_FOLDER_LITERAL,FolderType.FOLDER_LITERAL)) {
    actions.add(addAction);
  }
  if (viewObj.getProperty().getItem() instanceof MDMServerObjectItem) {
    actions.add(renameAction);
    actions.add(deployToAction);
    addAction(actions,deployToLastServerAction,viewObj);
    actions.add(exportDataClusterAction);
  }
  actions.add(deployAllAction);
  return actions;
}
Program: 147947
Project: 147947
Buggy source:
@Override public void initCommonViewer(CommonViewer commonViewer){
  super.initCommonViewer(commonViewer);
  addAction=initRepositoryAction(new NewDataContainerAction(),commonViewer);
  exportDataClusterAction=initRepositoryAction(new ExportDataClusterAction(),commonViewer);
}

Fixed version (ground truth):
@Override public void initCommonViewer(CommonViewer commonViewer){
  super.initCommonViewer(commonViewer);
  addAction=initRepositoryAction(new NewDataContainerAction(),commonViewer);
  exportDataClusterAction=initRepositoryAction(new ExportDataClusterAction(),commonViewer);
  importDataClusterAction=initRepositoryAction(new ImportDataClusterAction(),commonViewer);
}
Program: 147948
Project: 147948
Buggy source:
@Override public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj){
  List<AbstractRepositoryAction> actions=super.getActions(viewObj);
  if (RepositoryResourceUtil.hasContainerItem(viewObj,FolderType.SYSTEM_FOLDER_LITERAL,FolderType.FOLDER_LITERAL)) {
    actions.add(addAction);
  }
  if (viewObj.getProperty().getItem() instanceof MDMServerObjectItem) {
    actions.add(renameAction);
    actions.add(deployToAction);
    addAction(actions,deployToLastServerAction,viewObj);
    actions.add(exportDataClusterAction);
  }
  actions.add(deployAllAction);
  return actions;
}

Fixed version (ground truth):
@Override public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj){
  List<AbstractRepositoryAction> actions=super.getActions(viewObj);
  if (RepositoryResourceUtil.hasContainerItem(viewObj,FolderType.SYSTEM_FOLDER_LITERAL,FolderType.FOLDER_LITERAL)) {
    actions.add(addAction);
  }
  if (viewObj.getProperty().getItem() instanceof MDMServerObjectItem) {
    actions.add(renameAction);
    actions.add(deployToAction);
    addAction(actions,deployToLastServerAction,viewObj);
    actions.add(exportDataClusterAction);
  }
  actions.add(deployAllAction);
  actions.add(importDataClusterAction);
  return actions;
}
Program: 147949
Project: 147949
Buggy source:
public boolean copyViewObj(IRepositoryViewObject dragViewObj,IRepositoryViewObject dropViewObj){
  if (dropViewObj != null && dragViewObj != null) {
    Property dragProp=dropViewObj.getProperty();
    MDMServerObject serverObj=((MDMServerObjectItem)dragProp.getItem()).getMDMServerObject();
    IRepositoryViewObject dragParentViewObj=getParentRepositoryViewObject(dragViewObj);
    ContainerItem dragParentItem=(ContainerItem)dragParentViewObj.getProperty().getItem();
    String newName=showPasteDlg(dragParentItem.getRepObjType(),dragParentItem,"String_Node_Str" + serverObj.getName());
    if (newName != null) {
      String pathStr=dragProp.getItem().getState().getPath();
      IPath path=new Path(pathStr);
      IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
      try {
        Item copy=factory.copy(dragProp.getItem(),path,true);
        if (copy instanceof MDMServerObjectItem) {
          ((MDMServerObjectItem)copy).getMDMServerObject().setName(newName);
        }
        newName=RepositoryResourceUtil.escapeSpecialCharacters(newName);
        copy.getProperty().setLabel(newName);
        factory.save(copy);
        return true;
      }
 catch (      PersistenceException e) {
        log.error(e.getMessage(),e);
      }
catch (      BusinessException 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=dropViewObj.getProperty();
    MDMServerObject serverObj=((MDMServerObjectItem)dragProp.getItem()).getMDMServerObject();
    IRepositoryViewObject dragParentViewObj=getParentRepositoryViewObject(dragViewObj);
    ContainerItem dragParentItem=(ContainerItem)dragParentViewObj.getProperty().getItem();
    String newName=showPasteDlg(dragParentItem.getRepObjType(),dragParentItem,"String_Node_Str" + serverObj.getName());
    if (newName != null) {
      String pathStr=dragProp.getItem().getState().getPath();
      IPath path=new Path(pathStr);
      IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
      try {
        Item copy=factory.copy(dragProp.getItem(),path,true);
        if (copy instanceof MDMServerObjectItem) {
          ((MDMServerObjectItem)copy).getMDMServerObject().setName(newName);
        }
        copy.getProperty().setLabel(newName);
        factory.save(copy);
        return true;
      }
 catch (      PersistenceException e) {
        log.error(e.getMessage(),e);
      }
catch (      BusinessException e) {
        log.error(e.getMessage(),e);
      }
    }
  }
  return false;
}