nus-yam/ex-repair huggingface dataset:
Program: 147950
Project: 147950
Buggy source:
@Override public void run(){
  Object obj=getSelectedObject().get(0);
  if (obj instanceof IRepositoryViewObject) {
    IRepositoryViewObject viewObj=(IRepositoryViewObject)obj;
    MDMServerObjectItem item=(MDMServerObjectItem)viewObj.getProperty().getItem();
    MDMServerObject serverObject=item.getMDMServerObject();
    IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (configuration != null) {
      ERepositoryObjectType type=configuration.getResourceProvider().getRepositoryObjectType(item);
      IRepositoryViewObject parentViewObj=ContainerCacheService.get(type,item.getState().getPath());
      try {
        if (serverObject != null) {
          String oldName=serverObject.getName();
          String newName=showRenameDlg(type,(ContainerItem)parentViewObj.getProperty().getItem(),oldName);
          if (newName != null) {
            serverObject.setName(newName);
            newName=RepositoryResourceUtil.escapeSpecialCharacters(newName);
            viewObj.getProperty().setLabel(newName);
            factory.save(viewObj.getProperty().getItem(),false);
            CommandManager.getInstance().pushCommand(ICommand.CMD_RENAME,viewObj.getId(),new String[]{oldName,newName});
          }
        }
        commonViewer.refresh(obj);
      }
 catch (      PersistenceException e) {
        log.error(e.getMessage(),e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  Object obj=getSelectedObject().get(0);
  if (obj instanceof IRepositoryViewObject) {
    IRepositoryViewObject viewObj=(IRepositoryViewObject)obj;
    MDMServerObjectItem item=(MDMServerObjectItem)viewObj.getProperty().getItem();
    MDMServerObject serverObject=item.getMDMServerObject();
    IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (configuration != null) {
      ERepositoryObjectType type=configuration.getResourceProvider().getRepositoryObjectType(item);
      IRepositoryViewObject parentViewObj=ContainerCacheService.get(type,item.getState().getPath());
      try {
        if (serverObject != null) {
          String oldName=serverObject.getName();
          String newName=showRenameDlg(type,(ContainerItem)parentViewObj.getProperty().getItem(),oldName);
          if (newName != null) {
            serverObject.setName(newName);
            viewObj.getProperty().setLabel(newName);
            factory.save(viewObj.getProperty().getItem(),false);
            CommandManager.getInstance().pushCommand(ICommand.CMD_RENAME,viewObj.getId(),new String[]{oldName,newName});
          }
        }
        commonViewer.refresh(obj);
      }
 catch (      PersistenceException e) {
        log.error(e.getMessage(),e);
      }
    }
  }
}
Program: 147951
Project: 147951
Buggy source:
@Override public boolean performFinish(){
  if (alreadyEditedByUser) {
    return false;
  }
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  MDMServerObjectItem item=(MDMServerObjectItem)object.getProperty().getItem();
  String newName=object.getLabel();
  MDMServerObject serverObject=item.getMDMServerObject();
  try {
    if (serverObject != null) {
      String oldName=serverObject.getName();
      if (newName != null) {
        serverObject.setName(newName);
        newName=RepositoryResourceUtil.escapeSpecialCharacters(newName);
        object.getProperty().setLabel(newName);
        factory.save(object.getProperty().getItem(),false);
        if (!oldName.equals(newName)) {
          CommandManager.getInstance().pushCommand(ICommand.CMD_RENAME,object.getId(),new String[]{oldName,newName});
        }
      }
    }
  }
 catch (  PersistenceException e) {
    MessageBoxExceptionHandler.process(e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  if (alreadyEditedByUser) {
    return false;
  }
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  MDMServerObjectItem item=(MDMServerObjectItem)object.getProperty().getItem();
  String newName=object.getLabel();
  MDMServerObject serverObject=item.getMDMServerObject();
  try {
    if (serverObject != null) {
      String oldName=serverObject.getName();
      if (newName != null) {
        serverObject.setName(newName);
        object.getProperty().setLabel(newName);
        factory.save(object.getProperty().getItem(),false);
        if (!oldName.equals(newName)) {
          CommandManager.getInstance().pushCommand(ICommand.CMD_RENAME,object.getId(),new String[]{oldName,newName});
        }
      }
    }
  }
 catch (  PersistenceException e) {
    MessageBoxExceptionHandler.process(e);
    return false;
  }
  return true;
}
Program: 147952
Project: 147952
Buggy source:
public static IFile findReferenceFile(ERepositoryObjectType type,Item item,String fileExtension){
  IFolder folder=RepositoryResourceUtil.getFolder(type);
  String path=item.getState().getPath();
  if (path != null && path.length() > 0) {
    folder=folder.getFolder(path);
  }
  String name=null;
  Property property=item.getProperty();
  name=property.getLabel();
  String fileName=name + UNDERLINE + property.getVersion()+ DOT+ (fileExtension != null ? fileExtension : "String_Node_Str");
  IFile file=folder.getFile(fileName);
  return file;
}

Fixed version (ground truth):
public static IFile findReferenceFile(ERepositoryObjectType type,Item item,String fileExtension){
  IFolder folder=RepositoryResourceUtil.getFolder(type);
  String path=item.getState().getPath();
  if (path != null && path.length() > 0) {
    folder=folder.getFolder(path);
  }
  Property property=item.getProperty();
  String fileName=ResourceFilenameHelper.getExpectedFileName(property.getLabel(),property.getVersion()) + DOT + (fileExtension != null ? fileExtension : "String_Node_Str");
  IFile file=folder.getFile(fileName);
  return file;
}
Program: 147953
Project: 147953
Buggy source:
public static boolean createItem(Item item,String propLabel,String version,boolean pushCommandStack){
  String name=propLabel;
  propLabel=escapeSpecialCharacters(propLabel);
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  RepositoryContext context=factory.getRepositoryContext();
  Property prop=PropertiesFactory.eINSTANCE.createProperty();
  item.setProperty(prop);
  try {
    String nextId=factory.getNextId();
    Property property=item.getProperty();
    property.setId(nextId);
    property.setVersion(version);
    property.setAuthor(context.getUser());
    property.setLabel(propLabel);
    factory.create(item,new Path(item.getState().getPath()));
    IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (configuration != null) {
      IRepositoryNodeResourceProvider resourceProvider=configuration.getResourceProvider();
      if (resourceProvider.needSaveReferenceFile()) {
        resourceProvider.handleReferenceFile(item);
      }
    }
    if (pushCommandStack) {
      CommandManager.getInstance().pushCommand(ICommand.CMD_ADD,nextId,name);
    }
    return true;
  }
 catch (  PersistenceException e) {
    log.error(e.getMessage(),e);
  }
  return false;
}

Fixed version (ground truth):
public static boolean createItem(Item item,String propLabel,String version,boolean pushCommandStack){
  String name=propLabel;
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  RepositoryContext context=factory.getRepositoryContext();
  Property prop=PropertiesFactory.eINSTANCE.createProperty();
  item.setProperty(prop);
  try {
    String nextId=factory.getNextId();
    Property property=item.getProperty();
    property.setId(nextId);
    property.setVersion(version);
    property.setAuthor(context.getUser());
    property.setLabel(propLabel);
    factory.create(item,new Path(item.getState().getPath()));
    IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (configuration != null) {
      IRepositoryNodeResourceProvider resourceProvider=configuration.getResourceProvider();
      if (resourceProvider.needSaveReferenceFile()) {
        resourceProvider.handleReferenceFile(item);
      }
    }
    if (pushCommandStack) {
      CommandManager.getInstance().pushCommand(ICommand.CMD_ADD,nextId,name);
    }
    return true;
  }
 catch (  PersistenceException e) {
    log.error(e.getMessage(),e);
  }
  return false;
}
Program: 147955
Project: 147955
Buggy source:
@Override protected void doSave(WSDataModel wsObject) throws Exception {
  XObjectEditorInput2 editorInput=(XObjectEditorInput2)getEditorInput();
  if (xsdFile != null) {
    String xsd=getXSDSchemaString();
    xsdFile.setCharset("String_Node_Str",null);
    xsdFile.setContents(new ByteArrayInputStream(xsd.getBytes("String_Node_Str")),IFile.FORCE,null);
  }
  MDMServerObjectItem serverObjectItem=(MDMServerObjectItem)editorInput.getInputItem();
  MDMServerObject serverObject=serverObjectItem.getMDMServerObject();
  EObject eObj=Bean2EObjUtil.getInstance().convertFromBean2EObj(wsObject,serverObject);
  if (eObj != null) {
    IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
    try {
      factory.save(serverObjectItem);
    }
 catch (    PersistenceException e) {
      log.error(e.getMessage(),e);
    }
  }
  refreshDirtyCue();
  if (PlatformUI.getPreferenceStore().getBoolean(PreferenceConstants.P_AUTO_DEPLOY)) {
    autoDeploy(serverObject);
  }
}

Fixed version (ground truth):
@Override protected void doSave(WSDataModel wsObject) throws Exception {
  XObjectEditorInput2 editorInput=(XObjectEditorInput2)getEditorInput();
  if (isGenView && xsdFile != null) {
    String xsd=getXSDSchemaString();
    xsdFile.setCharset("String_Node_Str",null);
    xsdFile.setContents(new ByteArrayInputStream(xsd.getBytes("String_Node_Str")),IFile.FORCE,null);
  }
  MDMServerObjectItem serverObjectItem=(MDMServerObjectItem)editorInput.getInputItem();
  MDMServerObject serverObject=serverObjectItem.getMDMServerObject();
  EObject eObj=Bean2EObjUtil.getInstance().convertFromBean2EObj(wsObject,serverObject);
  if (eObj != null) {
    IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
    try {
      factory.save(serverObjectItem);
    }
 catch (    PersistenceException e) {
      log.error(e.getMessage(),e);
    }
  }
  refreshDirtyCue();
  if (PlatformUI.getPreferenceStore().getBoolean(PreferenceConstants.P_AUTO_DEPLOY)) {
    autoDeploy(serverObject);
  }
}
Program: 147956
Project: 147956
Buggy source:
private boolean importServerItem(Collection<ItemRecord> items){
  if (items.size() == 0) {
    return true;
  }
  Iterator<ItemRecord> itemIt=items.iterator();
  while (itemIt.hasNext()) {
    ItemRecord itemRecord=itemIt.next();
    if (itemRecord.getExistingItemWithSameId() == null && itemRecord.getErrors() != null) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean importServerItem(Collection<ItemRecord> items){
  if (items.size() == 0) {
    return true;
  }
  Iterator<ItemRecord> itemIt=items.iterator();
  while (itemIt.hasNext()) {
    ItemRecord itemRecord=itemIt.next();
    if (itemRecord.getExistingItemWithSameId() == null && itemRecord.getErrors() != null && itemRecord.getErrors().size() > 0) {
      return true;
    }
  }
  return false;
}
Program: 147957
Project: 147957
Buggy source:
/** 
 * Initialize the menu.
 */
private void initializeMenu(){
  MenuManager menuManager=new MenuManager();
  addServerDefAction=new AddServerDefAction();
  menuManager.add(addServerDefAction);
  menuManager.add(new DeleteServerDefAction());
  menuManager.add(new EditServerDefAction());
  menuManager.add(new CheckConnectionAction());
  Menu contextMenu=menuManager.createContextMenu(tree);
  tree.setMenu(contextMenu);
  getSite().registerContextMenu(menuManager,treeViewer);
}

Fixed version (ground truth):
/** 
 * Initialize the menu.
 */
private void initializeMenu(){
  MenuManager menuManager=new MenuManager();
  addServerDefAction=new AddServerDefAction();
  menuManager.add(addServerDefAction);
  menuManager.add(new DeleteServerDefAction());
  menuManager.add(new EditServerDefAction());
  menuManager.add(new CheckConnectionAction());
  eventManagerAction=new EventManageAction();
  menuManager.add(eventManagerAction);
  Menu contextMenu=menuManager.createContextMenu(tree);
  tree.setMenu(contextMenu);
  getSite().registerContextMenu(menuManager,treeViewer);
}
Program: 147958
Project: 147958
Buggy source:
protected boolean filterRepositoryNode(TreeObject node){
  if (node == null) {
    return false;
  }
  if (node.getType() == TreeObject.SUBSCRIPTION_ENGINE || node.getType() == TreeObject.SERVICE_CONFIGURATION || !Util.IsEnterPrise() && node.getType() == TreeObject.WORKFLOW || !Util.IsEnterPrise() && node.getType() == TreeObject.WORKFLOW_PROCESS || node.getType() == TreeObject.JOB || node.getType() == TreeObject.JOB_REGISTRY) {
    return false;
  }
  if (!Util.IsEnterPrise()) {
    if (node.getType() == TreeObject.ROLE || node.getType() == TreeObject.UNIVERSE || node.getType() == TreeObject.SYNCHRONIZATIONPLAN) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
protected boolean filterRepositoryNode(TreeObject node,boolean isOverWrite){
  if (node == null) {
    return false;
  }
  if (node.getType() == TreeObject.SUBSCRIPTION_ENGINE || node.getType() == TreeObject.SERVICE_CONFIGURATION || !Util.IsEnterPrise() && node.getType() == TreeObject.WORKFLOW || !Util.IsEnterPrise() && node.getType() == TreeObject.WORKFLOW_PROCESS || node.getType() == TreeObject.JOB || node.getType() == TreeObject.JOB_REGISTRY) {
    return false;
  }
  if (!Util.IsEnterPrise()) {
    if (node.getType() == TreeObject.ROLE || node.getType() == TreeObject.UNIVERSE || node.getType() == TreeObject.SYNCHRONIZATIONPLAN) {
      return false;
    }
  }
  if (!isOverWrite) {
    if (isExist(node))     return false;
  }
  return true;
}
Program: 147959
Project: 147959
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  isOverrideAll=btnOverwrite.getSelection();
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  isOverrideAll=btnOverwrite.getSelection();
  treeViewer.setOverWrite(isOverrideAll);
  treeViewer.getViewer().refresh();
}
Program: 147961
Project: 147961
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  TreeObject node=(TreeObject)element;
  return filterRepositoryNode(node);
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  TreeObject node=(TreeObject)element;
  return filterRepositoryNode(node,isOverWrite);
}
Program: 147962
Project: 147962
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){
      treeViewer=new ContainerCheckedTreeViewer(parent);
      contentProvider=new TreeObjectContentProvider(serverRoot);
      treeViewer.setContentProvider(contentProvider);
      treeViewer.setLabelProvider(new ServerTreeLabelProvider());
      treeViewer.setInput(serverRoot);
      return treeViewer;
    }
    @Override protected boolean isNodeCollectable(    TreeItem item){
      return false;
    }
    @Override protected void refreshCompleted(){
      treeViewer.expandToLevel(3);
      restoreCheckedElements();
    }
  }
;
  filteredCheckboxTree.getViewer().addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      TreeObject node=(TreeObject)element;
      return filterRepositoryNode(node);
    }
  }
);
}

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){
      treeViewer=new ContainerCheckedTreeViewer(parent);
      contentProvider=new TreeObjectContentProvider(serverRoot);
      treeViewer.setContentProvider(contentProvider);
      treeViewer.setLabelProvider(new ServerTreeLabelProvider());
      treeViewer.setInput(serverRoot);
      return treeViewer;
    }
    @Override protected boolean isNodeCollectable(    TreeItem item){
      return false;
    }
    @Override protected void refreshCompleted(){
      treeViewer.expandToLevel(3);
      restoreCheckedElements();
    }
  }
;
  filteredCheckboxTree.getViewer().addFilter(new ViewerFilter(){
    @Override public boolean select(    Viewer viewer,    Object parentElement,    Object element){
      TreeObject node=(TreeObject)element;
      return filterRepositoryNode(node,isOverWrite);
    }
  }
);
}
Program: 147963
Project: 147963
Buggy source:
public String getCategoryLabel(ERepositoryObjectType type){
  return null;
}

Fixed version (ground truth):
public String getCategoryLabel(ERepositoryObjectType type){
  return getText(null);
}
Program: 147964
Project: 147964
Buggy source:
private String getLabel(Object element){
  if (element instanceof IRepositoryNodeConfiguration) {
    return ((IRepositoryNodeConfiguration)element).getLabelProvider().getCategoryLabel(null);
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
private String getLabel(Object element){
  if (element instanceof IRepositoryViewObject) {
    Item item=((IRepositoryViewObject)element).getProperty().getItem();
    IRepositoryNodeConfiguration conf=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (conf != null) {
      return conf.getLabelProvider().getText(element);
    }
  }
  return "String_Node_Str";
}
Program: 147967
Project: 147967
Buggy source:
private Set<String> getNewServerObjectPref(){
  Set<String> values=new HashSet<String>();
  for (  IRepositoryNodeConfiguration conf : enabledConfigs) {
    String label=getLabel(conf);
    if (label.length() > 0) {
      values.add(label);
    }
  }
  return values;
}

Fixed version (ground truth):
private Set<String> getNewServerObjectPref(){
  Set<String> values=new HashSet<String>();
  for (  IRepositoryViewObject conf : enabledConfigs) {
    String label=getLabel(conf);
    if (label.length() > 0) {
      values.add(label);
    }
  }
  return values;
}
Program: 147968
Project: 147968
Buggy source:
private void solveProcTriCase(){
  IRepositoryNodeConfiguration eventMgr=null;
  boolean exist=false;
  for (  IRepositoryNodeConfiguration conf : enabledConfigs) {
    if (conf instanceof EventManagerNodeConfiguration) {
      exist=true;
      break;
    }
    if (conf instanceof RoutingRuleNodeConfiguration || conf instanceof TransformerV2NodeConfiguration) {
      for (      IRepositoryNodeConfiguration confi : allConfigs) {
        if (confi instanceof EventManagerNodeConfiguration) {
          eventMgr=confi;
        }
      }
    }
  }
  if (eventMgr != null && !exist)   enabledConfigs.add(eventMgr);
}

Fixed version (ground truth):
private void solveProcTriCase(){
  IRepositoryViewObject eventMgr=null;
  boolean exist=false;
  for (  IRepositoryViewObject conf : enabledConfigs) {
    Item item=((IRepositoryViewObject)conf).getProperty().getItem();
    IRepositoryNodeConfiguration repositoryConf=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (repositoryConf instanceof EventManagerNodeConfiguration) {
      exist=true;
      break;
    }
    if (repositoryConf instanceof IRepositoryViewObject || repositoryConf instanceof TransformerV2NodeConfiguration) {
      for (      IRepositoryViewObject confi : allConfigs) {
        eventMgr=confi;
      }
    }
  }
  if (eventMgr != null && !exist)   enabledConfigs.add(eventMgr);
}
Program: 147969
Project: 147969
Buggy source:
public void checkStateChanged(CheckStateChangedEvent event){
  IRepositoryNodeConfiguration config=(IRepositoryNodeConfiguration)event.getElement();
  if (event.getChecked()) {
    enabledConfigs.add(config);
  }
 else {
    enabledConfigs.remove(config);
  }
  solveProcTriCase();
  enableAllBun.setSelection(enabledConfigs.size() == allConfigs.size());
}

Fixed version (ground truth):
public void checkStateChanged(CheckStateChangedEvent event){
  IRepositoryViewObject config=(IRepositoryViewObject)event.getElement();
  if (event.getChecked()) {
    enabledConfigs.add(config);
  }
 else {
    enabledConfigs.remove(config);
  }
  solveProcTriCase();
  enableAllBun.setSelection(enabledConfigs.size() == allConfigs.size());
}
Program: 147970
Project: 147970
Buggy source:
public static MDMServerObjectItem findServerObjectItemByName(ERepositoryObjectType type,String name){
  List<IRepositoryViewObject> viewObjects=RepositoryResourceUtil.findAllViewObjects(type);
  if (viewObjects != null) {
    for (    IRepositoryViewObject viewObj : viewObjects) {
      Item item=viewObj.getProperty().getItem();
      if (item instanceof MDMServerObjectItem) {
        MDMServerObject serverObject=((MDMServerObjectItem)item).getMDMServerObject();
        if (name != null && name.equals(serverObject.getUniqueName())) {
          return (MDMServerObjectItem)item;
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public static MDMServerObjectItem findServerObjectItemByName(ERepositoryObjectType type,String name){
  return findServerObjectItemByNameWithDeleted(type,name,false);
}
Program: 147971
Project: 147971
Buggy source:
public static boolean createItem(Item item,String propLabel,String version){
  String name=propLabel;
  propLabel=escapeSpecialCharacters(propLabel);
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  RepositoryContext context=factory.getRepositoryContext();
  Property prop=PropertiesFactory.eINSTANCE.createProperty();
  item.setProperty(prop);
  try {
    String nextId=factory.getNextId();
    Property property=item.getProperty();
    property.setId(nextId);
    property.setVersion(version);
    property.setAuthor(context.getUser());
    property.setLabel(propLabel);
    factory.create(item,new Path(item.getState().getPath()));
    IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (configuration != null) {
      IRepositoryNodeResourceProvider resourceProvider=configuration.getResourceProvider();
      if (resourceProvider.needSaveReferenceFile()) {
        resourceProvider.handleReferenceFile(item);
      }
    }
    CommandManager.getInstance().pushCommand(ICommand.CMD_ADD,nextId,name);
    return true;
  }
 catch (  PersistenceException e) {
    log.error(e.getMessage(),e);
  }
  return false;
}

Fixed version (ground truth):
public static boolean createItem(Item item,String propLabel,String version,boolean pushCommandStack){
  String name=propLabel;
  propLabel=escapeSpecialCharacters(propLabel);
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  RepositoryContext context=factory.getRepositoryContext();
  Property prop=PropertiesFactory.eINSTANCE.createProperty();
  item.setProperty(prop);
  try {
    String nextId=factory.getNextId();
    Property property=item.getProperty();
    property.setId(nextId);
    property.setVersion(version);
    property.setAuthor(context.getUser());
    property.setLabel(propLabel);
    factory.create(item,new Path(item.getState().getPath()));
    IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
    if (configuration != null) {
      IRepositoryNodeResourceProvider resourceProvider=configuration.getResourceProvider();
      if (resourceProvider.needSaveReferenceFile()) {
        resourceProvider.handleReferenceFile(item);
      }
    }
    if (pushCommandStack) {
      CommandManager.getInstance().pushCommand(ICommand.CMD_ADD,nextId,name);
    }
    return true;
  }
 catch (  PersistenceException e) {
    log.error(e.getMessage(),e);
  }
  return false;
}
Program: 147974
Project: 147974
Buggy source:
public XSDVisibleRuleAction(DataModelMainPage page,String dataModelName){
  super(page);
  setImageDescriptor(ImageCache.getImage(EImage.ROUTINE.getPath()));
  setText("String_Node_Str");
  setToolTipText("String_Node_Str");
  this.dataModelName=dataModelName;
}

Fixed version (ground truth):
public XSDVisibleRuleAction(DataModelMainPage page,String dataModelName,boolean isDelete){
  super(page);
  setImageDescriptor(ImageCache.getImage(EImage.DELETE_OBJ.getPath()));
  setText("String_Node_Str");
  setToolTipText("String_Node_Str");
  this.dataModelName=dataModelName;
  this.isDelete=isDelete;
}
Program: 147975
Project: 147975
Buggy source:
private void setAnnotationActions(Object obj,IMenuManager manager){
  if (obj instanceof XSDElementDeclaration) {
    manager.add(setAnnotationDescriptionsAction);
    manager.add(setAnnotationLookupFieldsAction);
    manager.add(setAnnotationPrimaryKeyInfoAction);
  }
  if (obj instanceof XSDParticle) {
    manager.add(setAnnotationDescriptionsAction);
    manager.add(setAnnotationLabelAction);
    manager.add(setAnnotationForeignKeyAction);
    manager.add(setAnnotationFKFilterAction);
    manager.add(setAnnotationForeignKeyInfoAction);
  }
  if (Util.IsEnterPrise()) {
    manager.add(new Separator());
    manager.add(setAnnotationWriteAction);
    manager.add(setAnnotationNoAction);
    if (obj instanceof XSDParticle) {
      manager.add(visibleRuleAction);
      XSDParticle xsdParticle=(XSDParticle)obj;
      XSDTerm xsdTerm=xsdParticle.getTerm();
      if (xsdTerm instanceof XSDElementDeclaration) {
        if (Util.getKeyInfo(xsdTerm) == null || Util.getKeyInfo(xsdTerm).size() == 0) {
          manager.add(defaultValueRuleAction);
        }
      }
    }
  }
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels(isLocalInput());
  for (int i=0; i < availablemodels.size(); i++) {
    IAvailableModel model=availablemodels.get(i);
    model.fillContextMenu(obj,manager,this,dataModelName);
    if (i == 1) {
      manager.add(new Separator());
    }
  }
}

Fixed version (ground truth):
private void setAnnotationActions(Object obj,IMenuManager manager){
  if (obj instanceof XSDElementDeclaration) {
    manager.add(setAnnotationDescriptionsAction);
    manager.add(setAnnotationLookupFieldsAction);
    manager.add(setAnnotationPrimaryKeyInfoAction);
  }
  if (obj instanceof XSDParticle) {
    manager.add(setAnnotationDescriptionsAction);
    manager.add(setAnnotationLabelAction);
    manager.add(setAnnotationForeignKeyAction);
    manager.add(setAnnotationFKFilterAction);
    manager.add(setAnnotationForeignKeyInfoAction);
  }
  if (Util.IsEnterPrise()) {
    manager.add(new Separator());
    manager.add(setAnnotationWriteAction);
    manager.add(setAnnotationNoAction);
    if (obj instanceof XSDParticle) {
      manager.add(visibleRuleAction);
      XSDVisibleRuleAction deleteVisibleRuleAction=new XSDVisibleRuleAction(this,dataModelName,true);
      manager.add(deleteVisibleRuleAction);
      XSDParticle xsdParticle=(XSDParticle)obj;
      XSDTerm xsdTerm=xsdParticle.getTerm();
      if (xsdTerm instanceof XSDElementDeclaration) {
        if (Util.getKeyInfo(xsdTerm) == null || Util.getKeyInfo(xsdTerm).size() == 0) {
          manager.add(defaultValueRuleAction);
        }
      }
    }
  }
  java.util.List<IAvailableModel> availablemodels=AvailableModelUtil.getAvailableModels(isLocalInput());
  for (int i=0; i < availablemodels.size(); i++) {
    IAvailableModel model=availablemodels.get(i);
    model.fillContextMenu(obj,manager,this,dataModelName);
    if (i == 1) {
      manager.add(new Separator());
    }
  }
}
Program: 147976
Project: 147976
Buggy source:
public List<AbstractDeployCommand> getDeployCommands(List<IRepositoryViewObject> viewObjs){
  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);
      }
    }
  }
  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.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;
}
Program: 147977
Project: 147977
Buggy source:
public IStatus deploy(MDMServerDef serverDef,List<IRepositoryViewObject> viewObjs){
  CommandManager manager=CommandManager.getInstance();
  List<AbstractDeployCommand> commands=manager.getDeployCommands(viewObjs);
  return runCommands(commands,serverDef);
}

Fixed version (ground truth):
public IStatus deploy(MDMServerDef serverDef,List<IRepositoryViewObject> viewObjs,int defaultCmdType){
  CommandManager manager=CommandManager.getInstance();
  List<AbstractDeployCommand> commands=manager.getDeployCommands(viewObjs,defaultCmdType);
  return runCommands(commands,serverDef);
}
Program: 147978
Project: 147978
Buggy source:
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj){
  List<AbstractRepositoryAction> actions=new LinkedList<AbstractRepositoryAction>();
  Item item=viewObj.getProperty().getItem();
  if (item instanceof MDMItem) {
    if (item instanceof ContainerItem) {
      FolderType type=((FolderItem)item).getType();
switch (type.getValue()) {
case FolderType.SYSTEM_FOLDER:
        actions.add(createFolderAction);
      addAction(actions,pasteAction,viewObj);
    actions.add(importServerObjectAction);
  actions.add(importObjectAction);
break;
case FolderType.STABLE_SYSTEM_FOLDER:
break;
case FolderType.FOLDER:
actions.add(createFolderAction);
actions.add(removeFromRepositoryAction);
addAction(actions,pasteAction,viewObj);
break;
}
}
 else if (item instanceof MDMServerObjectItem) {
actions.add(removeFromRepositoryAction);
actions.add(mdmEditPropertyAction);
addAction(actions,copyAction,viewObj);
addAction(actions,pasteAction,viewObj);
actions.add(duplicateAction);
}
}
actions.add(refreshAction);
actions.add(exportObjectAction);
for (IRepositoryNodeActionProvider provider : getExtendActionProviders()) {
List<AbstractRepositoryAction> providerActions=provider.getActions(viewObj);
if (providerActions != null) {
actions.addAll(providerActions);
}
}
if (IServerObjectRepositoryType.TYPE_EVENTMANAGER.equals(viewObj.getRepositoryObjectType())) {
actions.add(emAction);
}
return actions;
}

Fixed version (ground truth):
public List<AbstractRepositoryAction> getActions(IRepositoryViewObject viewObj){
  List<AbstractRepositoryAction> actions=new LinkedList<AbstractRepositoryAction>();
  Item item=viewObj.getProperty().getItem();
  if (item instanceof MDMItem) {
    if (item instanceof ContainerItem) {
      FolderType type=((FolderItem)item).getType();
switch (type.getValue()) {
case FolderType.SYSTEM_FOLDER:
        actions.add(createFolderAction);
      addAction(actions,pasteAction,viewObj);
    actions.add(importServerObjectAction);
  actions.add(importObjectAction);
break;
case FolderType.STABLE_SYSTEM_FOLDER:
break;
case FolderType.FOLDER:
actions.add(createFolderAction);
actions.add(removeFromRepositoryAction);
addAction(actions,pasteAction,viewObj);
break;
}
}
 else if (item instanceof MDMServerObjectItem) {
actions.add(removeFromRepositoryAction);
actions.add(mdmEditPropertyAction);
addAction(actions,copyAction,viewObj);
addAction(actions,pasteAction,viewObj);
actions.add(duplicateAction);
}
}
actions.add(refreshAction);
actions.add(exportObjectAction);
for (IRepositoryNodeActionProvider provider : getExtendActionProviders()) {
List<AbstractRepositoryAction> providerActions=provider.getActions(viewObj);
if (providerActions != null) {
actions.addAll(providerActions);
}
}
if (viewObj.getRepositoryObjectType() != null && IServerObjectRepositoryType.TYPE_EVENTMANAGER.equals(viewObj.getRepositoryObjectType())) {
actions.add(emAction);
}
return actions;
}
Program: 147979
Project: 147979
Buggy source:
private void updateServerDef(IRepositoryViewObject viewObj){
  if (hasSameServerDef) {
    Item item=viewObj.getProperty().getItem();
    MDMServerDef serverDef=((MDMServerObjectItem)item).getMDMServerObject().getLastServerDef();
    if (lastServerDef == null) {
      lastServerDef=serverDef;
    }
 else {
      if (!lastServerDef.equals(serverDef)) {
        lastServerDef=null;
        hasSameServerDef=false;
      }
    }
  }
}

Fixed version (ground truth):
private void updateServerDef(IRepositoryViewObject viewObj){
  if (hasSameServerDef) {
    Item item=viewObj.getProperty().getItem();
    if (item instanceof ContainerItem)     return;
    MDMServerDef serverDef=((MDMServerObjectItem)item).getMDMServerObject().getLastServerDef();
    if (lastServerDef == null) {
      lastServerDef=serverDef;
    }
 else {
      if (!lastServerDef.equals(serverDef)) {
        lastServerDef=null;
        hasSameServerDef=false;
      }
    }
  }
}
Program: 147980
Project: 147980
Buggy source:
public void restoreState(IMemento aMemento){
  if (map.isEmpty()) {
    IMemento cmdManagerMem=aMemento.getChild(ICommand.MDM_COMMANDS);
    if (cmdManagerMem != null) {
      IMemento[] stackMems=cmdManagerMem.getChildren(ICommand.MEM_TYPE_COMMAND_STACK);
      if (stackMems != null) {
        for (        IMemento stackMem : stackMems) {
          CommandStack stack=new CommandStack();
          stack.restoreState(stackMem);
          if (stack.getCommandId() != null) {
            map.put(stack.getCommandId(),stack);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void restoreState(IMemento aMemento){
  if (map.isEmpty() && aMemento != null) {
    IMemento cmdManagerMem=aMemento.getChild(ICommand.MDM_COMMANDS);
    if (cmdManagerMem != null) {
      IMemento[] stackMems=cmdManagerMem.getChildren(ICommand.MEM_TYPE_COMMAND_STACK);
      if (stackMems != null) {
        for (        IMemento stackMem : stackMems) {
          CommandStack stack=new CommandStack();
          stack.restoreState(stackMem);
          if (stack.getCommandId() != null) {
            map.put(stack.getCommandId(),stack);
          }
        }
      }
    }
  }
}
Program: 147986
Project: 147986
Buggy source:
public ERepositoryObjectType getRepositoryObjectType(Item item){
  IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
  if (configuration != null) {
    return configuration.getResourceProvider().getRepositoryObjectType(item);
  }
  return null;
}

Fixed version (ground truth):
public ERepositoryObjectType getRepositoryObjectType(Item item){
  if (item.eClass().getName().equals("String_Node_Str")) {
    return null;
  }
  IRepositoryNodeConfiguration configuration=RepositoryNodeConfigurationManager.getConfiguration(item);
  if (configuration != null) {
    return configuration.getResourceProvider().getRepositoryObjectType(item);
  }
  return null;
}
Program: 147990
Project: 147990
Buggy source:
public void startSubscriptionEngine(){
  try {
    XtentisPort port=Util.getPort(getXObject());
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.START));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void startSubscriptionEngine(){
  try {
    XtentisPort port=getPort();
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.START));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 147992
Project: 147992
Buggy source:
protected void refreshData(){
  try {
    XtentisPort port=Util.getPort(getXObject());
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.STATUS));
    statusLabel.setText(status.getValue());
    idText.setFocus();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
protected void refreshData(){
  try {
    XtentisPort port=getPort();
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.STATUS));
    statusLabel.setText(status.getValue());
    idText.setFocus();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 147993
Project: 147993
Buggy source:
public void resumeSubscriptionEngine(){
  try {
    XtentisPort port=Util.getPort(getXObject());
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.RESUME));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void resumeSubscriptionEngine(){
  try {
    XtentisPort port=getPort();
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.RESUME));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 147994
Project: 147994
Buggy source:
public void suspendSubscriptionEngine(){
  try {
    XtentisPort port=Util.getPort(getXObject());
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.SUSPEND));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void suspendSubscriptionEngine(){
  try {
    XtentisPort port=getPort();
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.SUSPEND));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 147996
Project: 147996
Buggy source:
public void stopSubscriptionEngine(){
  try {
    XtentisPort port=Util.getPort(getXObject());
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.STOP));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void stopSubscriptionEngine(){
  try {
    XtentisPort port=getPort();
    WSRoutingEngineV2Status status=port.routingEngineV2Action(new WSRoutingEngineV2Action(WSRoutingEngineV2ActionCode.STOP));
    statusLabel.setText(status.getValue());
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(this.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
  }
}
Program: 147997
Project: 147997
Buggy source:
@Override public void doImport(Object[] selectedObjs,IProgressMonitor monitor){
  List<ItemRecord> itemRecords=new LinkedList<ItemRecord>();
  for (  Object obj : selectedObjs) {
    if (obj instanceof ItemRecord) {
      itemRecords.add((ItemRecord)obj);
    }
  }
  repositoryUtil.importItemRecords(manager,itemRecords,monitor,isOverride,null,"String_Node_Str");
  monitor.beginTask("String_Node_Str",20);
  HashMap<String,String> picturePathMap=new HashMap<String,String>();
  for (  TreeObject item : dataClusters) {
    try {
      importClusterContents(item,Util.getPort(item),picturePathMap);
    }
 catch (    Exception e) {
      log.error(e);
    }
  }
  monitor.done();
}

Fixed version (ground truth):
@Override public void doImport(Object[] selectedObjs,IProgressMonitor monitor){
  List<ItemRecord> itemRecords=new LinkedList<ItemRecord>();
  for (  Object obj : selectedObjs) {
    if (obj instanceof ItemRecord) {
      itemRecords.add((ItemRecord)obj);
    }
  }
  for (  ItemRecord itemRec : itemRecords) {
    Item item=itemRec.getProperty().getItem();
    MDMServerObject serverObj=null;
    if (item instanceof MDMServerObjectItem) {
      serverObj=((MDMServerObjectItem)item).getMDMServerObject();
      if (serverObj.getLastServerDef() != null) {
        serverObj.setLastServerDef(null);
      }
    }
  }
  repositoryUtil.importItemRecords(manager,itemRecords,monitor,isOverride,null,"String_Node_Str");
  monitor.beginTask("String_Node_Str",20);
  HashMap<String,String> picturePathMap=new HashMap<String,String>();
  for (  TreeObject item : dataClusters) {
    try {
      importClusterContents(item,Util.getPort(item),picturePathMap);
    }
 catch (    Exception e) {
      log.error(e);
    }
  }
  monitor.done();
}
Program: 147998
Project: 147998
Buggy source:
public String isValid(String newText){
  if (newText == null || newText.trim().length() == 0)   return Messages.Common_nameCanNotBeEmpty;
  if (!Pattern.matches("String_Node_Str",newText)) {
    return Messages.Common_nameInvalid;
  }
  if (RepositoryResourceUtil.isExistByName(parentItem.getRepObjType(),newText.trim())) {
    return Messages.Common_nameIsUsed;
  }
  return null;
}

Fixed version (ground truth):
public String isValid(String newText){
  if (newText == null || newText.trim().length() == 0)   return Messages.Common_nameCanNotBeEmpty;
  if (type.equals(IServerObjectRepositoryType.TYPE_TRANSFORMERV2) || type.equals(IServerObjectRepositoryType.TYPE_VIEW)) {
    if (!Pattern.matches("String_Node_Str",newText)) {
      return Messages.Common_nameInvalid;
    }
  }
 else   if (!Pattern.matches("String_Node_Str",newText)) {
    return Messages.Common_nameInvalid;
  }
  if (RepositoryResourceUtil.isExistByName(parentItem.getRepObjType(),newText.trim())) {
    return Messages.Common_nameIsUsed;
  }
  return null;
}
Program: 147999
Project: 147999
Buggy source:
private String showPasteDlg(final ERepositoryObjectType type,final ContainerItem parentItem,String initLabel){
  InputDialog dlg=new InputDialog(getShell(),Messages.RepositoryDropAssistant_pasteObject,Messages.Common_inputName,initLabel,new IInputValidator(){
    public String isValid(    String newText){
      if (newText == null || newText.trim().length() == 0)       return Messages.Common_nameCanNotBeEmpty;
      if (!Pattern.matches("String_Node_Str",newText)) {
        return Messages.Common_nameInvalid;
      }
      if (RepositoryResourceUtil.isExistByName(parentItem.getRepObjType(),newText.trim())) {
        return Messages.Common_nameIsUsed;
      }
      return null;
    }
  }
);
  dlg.setBlockOnOpen(true);
  if (dlg.open() == Window.CANCEL)   return null;
  return dlg.getValue();
}

Fixed version (ground truth):
private String showPasteDlg(final ERepositoryObjectType type,final ContainerItem parentItem,String initLabel){
  InputDialog dlg=new InputDialog(getShell(),Messages.RepositoryDropAssistant_pasteObject,Messages.Common_inputName,initLabel,new IInputValidator(){
    public String isValid(    String newText){
      if (newText == null || newText.trim().length() == 0)       return Messages.Common_nameCanNotBeEmpty;
      if (type.equals(IServerObjectRepositoryType.TYPE_TRANSFORMERV2) || type.equals(IServerObjectRepositoryType.TYPE_VIEW)) {
        if (!Pattern.matches("String_Node_Str",newText)) {
          return Messages.Common_nameInvalid;
        }
      }
 else       if (!Pattern.matches("String_Node_Str",newText)) {
        return Messages.Common_nameInvalid;
      }
      if (RepositoryResourceUtil.isExistByName(parentItem.getRepObjType(),newText.trim())) {
        return Messages.Common_nameIsUsed;
      }
      return null;
    }
  }
);
  dlg.setBlockOnOpen(true);
  if (dlg.open() == Window.CANCEL)   return null;
  return dlg.getValue();
}
Program: 148000
Project: 148000
Buggy source:
public String isValid(String newText){
  if (newText == null || newText.trim().length() == 0)   return Messages.Common_nameCanNotBeEmpty;
  if (!Pattern.matches("String_Node_Str",newText)) {
    return Messages.Common_nameInvalid;
  }
  if (RepositoryResourceUtil.isExistByName(parentItem.getRepObjType(),newText.trim())) {
    return Messages.Common_nameIsUsed;
  }
  return null;
}

Fixed version (ground truth):
public String isValid(String newText){
  if (newText == null || newText.trim().length() == 0)   return Messages.Common_nameCanNotBeEmpty;
  if (type.equals(IServerObjectRepositoryType.TYPE_TRANSFORMERV2) || type.equals(IServerObjectRepositoryType.TYPE_VIEW)) {
    if (!Pattern.matches("String_Node_Str",newText)) {
      return Messages.Common_nameInvalid;
    }
  }
 else   if (!Pattern.matches("String_Node_Str",newText)) {
    return Messages.Common_nameInvalid;
  }
  if (RepositoryResourceUtil.isExistByName(parentItem.getRepObjType(),newText.trim())) {
    return Messages.Common_nameIsUsed;
  }
  return null;
}