nus-yam/ex-repair huggingface dataset:
Program: 145891
Project: 145891
Buggy source:
@Override public String update(TestStructure testStructure,TranslationService translationService) throws SystemException {
  String resultState="String_Node_Str";
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + testStructure.getFullName());
  }
  try {
    TestProject testProject=testStructure.getRootElement();
    SVNClientManager clientManager=getSVNClientManager(testProject);
    SVNUpdateClient updateClient=clientManager.getUpdateClient();
    File checkoutFile=getFile(testStructure);
    long revisionNumber=updateClient.doUpdate(checkoutFile,SVNRevision.HEAD,SVNDepth.INFINITY,true,true);
    resultState=translationService.translate("String_Node_Str","String_Node_Str") + "String_Node_Str" + revisionNumber;
    if (logger.isInfoEnabled()) {
      logger.info("String_Node_Str" + revisionNumber);
    }
    revertMemoryModel(testStructure);
    SVNStatusClient statusClient=clientManager.getStatusClient();
    List<String> conflicts=checkWcState(statusClient,checkoutFile,revisionNumber);
    if (!conflicts.isEmpty()) {
      throw new SystemException(createConflictErrorMessage(conflicts,translationService));
    }
    fireEvents(testStructure);
  }
 catch (  SVNException e) {
    logger.error(e.getMessage(),e);
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
  return resultState;
}

Fixed version (ground truth):
@Override public String update(TestStructure testStructure,TranslationService translationService) throws SystemException {
  String resultState="String_Node_Str";
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
  try {
    TestProject testProject=testStructure.getRootElement();
    SVNClientManager clientManager=getSVNClientManager(testProject);
    SVNUpdateClient updateClient=clientManager.getUpdateClient();
    File checkoutFile=getFile(testStructure);
    long revisionNumber=updateClient.doUpdate(checkoutFile,SVNRevision.HEAD,SVNDepth.INFINITY,true,true);
    resultState=translationService.translate("String_Node_Str","String_Node_Str") + "String_Node_Str" + revisionNumber;
    logger.info("String_Node_Str" + revisionNumber);
    revertMemoryModel(testStructure);
    SVNStatusClient statusClient=clientManager.getStatusClient();
    List<String> conflicts=checkWcState(statusClient,checkoutFile,revisionNumber);
    if (!conflicts.isEmpty()) {
      throw new SystemException(createConflictErrorMessage(conflicts,translationService));
    }
    fireEvents(testStructure);
  }
 catch (  SVNException e) {
    logger.error(e.getMessage(),e);
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
  return resultState;
}
Program: 145893
Project: 145893
Buggy source:
@Override public void delete(TestStructure testStructure,TranslationService translationService) throws SystemException {
  SVNClientManager clientManager=getSVNClientManager(testStructure.getRootElement());
  SVNStatusClient statusClient=clientManager.getStatusClient();
  final SVNWCClient wcClient=clientManager.getWCClient();
  ISVNStatusHandler statusHandler=new ISVNStatusHandler(){
    @Override public void handleStatus(    SVNStatus status) throws SVNException {
      if (status.getFile().isDirectory()) {
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + status.getNodeStatus().toString() + "String_Node_Str"+ status.getFile().getAbsolutePath());
        }
        wcClient.doDelete(status.getFile(),true,false,false);
      }
    }
  }
;
  List<String> changeLists=new ArrayList<String>();
  try {
    statusClient.doStatus(getFile(testStructure),SVNRevision.HEAD,SVNDepth.FILES,true,true,true,false,statusHandler,changeLists);
    updateSvnstate(testStructure);
  }
 catch (  SVNException e) {
    logger.error(e.getMessage());
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
catch (  Exception e) {
    logger.error(e);
    throw new SystemException(e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void delete(TestStructure testStructure,TranslationService translationService) throws SystemException {
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
  SVNClientManager clientManager=getSVNClientManager(testStructure.getRootElement());
  SVNStatusClient statusClient=clientManager.getStatusClient();
  final SVNWCClient wcClient=clientManager.getWCClient();
  ISVNStatusHandler statusHandler=new ISVNStatusHandler(){
    @Override public void handleStatus(    SVNStatus status) throws SVNException {
      if (status.getFile().isDirectory()) {
        if (logger.isTraceEnabled()) {
          logger.trace("String_Node_Str" + status.getNodeStatus().toString() + "String_Node_Str"+ status.getFile().getAbsolutePath());
        }
        wcClient.doDelete(status.getFile(),true,false,false);
      }
    }
  }
;
  List<String> changeLists=new ArrayList<String>();
  try {
    statusClient.doStatus(getFile(testStructure),SVNRevision.HEAD,SVNDepth.FILES,true,true,true,false,statusHandler,changeLists);
    updateSvnstate(testStructure);
  }
 catch (  SVNException e) {
    logger.error(e.getMessage());
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
catch (  Exception e) {
    logger.error(e);
    throw new SystemException(e.getMessage());
  }
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
}
Program: 145896
Project: 145896
Buggy source:
@Override public void removeAdditonalFile(TestStructure testStructure,String fileName) throws SystemException {
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + testStructure.getFullName() + "String_Node_Str"+ fileName);
  }
  TestProject testProject=testStructure.getRootElement();
  SVNWCClient wcClient=getSVNClientManager(testProject).getWCClient();
  File file=new File(getFile(testStructure),fileName);
  if (!file.exists()) {
    logger.info("String_Node_Str" + fileName + "String_Node_Str");
    return;
  }
  try {
    final SVNStatus info=getSVNClientManager(testProject).getStatusClient().doStatus(file,false);
    if (info.isVersioned()) {
      wcClient.doDelete(file,true,false,false);
    }
  }
 catch (  Exception e) {
    logger.warn(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void removeAdditonalFile(TestStructure testStructure,String fileName) throws SystemException {
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str"+ fileName);
  TestProject testProject=testStructure.getRootElement();
  SVNWCClient wcClient=getSVNClientManager(testProject).getWCClient();
  File file=new File(getFile(testStructure),fileName);
  if (!file.exists()) {
    logger.info("String_Node_Str" + fileName + "String_Node_Str");
    return;
  }
  try {
    final SVNStatus info=getSVNClientManager(testProject).getStatusClient().doStatus(file,false);
    if (info.isVersioned()) {
      wcClient.doDelete(file,true,false,false);
    }
  }
 catch (  Exception e) {
    logger.warn(e.getMessage());
  }
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
}
Program: 145898
Project: 145898
Buggy source:
/** 
 * Creates an instance of the svn client manager to work with svn.
 * @param testProject used to identify the svn.
 * @return client to access the svn.
 */
private SVNClientManager getSVNClientManager(TestProject testProject){
  String username=((SVNTeamShareConfig)(testProject.getTestProjectConfig().getTeamShareConfig())).getUserName();
  String password=((SVNTeamShareConfig)(testProject.getTestProjectConfig().getTeamShareConfig())).getPassword();
  ISVNAuthenticationManager authManager;
  if ((username == null || username.equals("String_Node_Str")) || (password == null || password.equals("String_Node_Str"))) {
    authManager=SVNWCUtil.createDefaultAuthenticationManager();
  }
 else {
    authManager=SVNWCUtil.createDefaultAuthenticationManager(username,password);
  }
  return SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true),authManager);
}

Fixed version (ground truth):
/** 
 * Creates an instance of the svn client manager to work with svn.
 * @param testProject used to identify the svn.
 * @return client to access the svn.
 */
private SVNClientManager getSVNClientManager(TestProject testProject){
  logger.trace("String_Node_Str");
  String username=((SVNTeamShareConfig)(testProject.getTestProjectConfig().getTeamShareConfig())).getUserName();
  String password=((SVNTeamShareConfig)(testProject.getTestProjectConfig().getTeamShareConfig())).getPassword();
  ISVNAuthenticationManager authManager;
  if ((username == null || username.equals("String_Node_Str")) || (password == null || password.equals("String_Node_Str"))) {
    authManager=SVNWCUtil.createDefaultAuthenticationManager();
  }
 else {
    authManager=SVNWCUtil.createDefaultAuthenticationManager(username,password);
  }
  SVNClientManager clientManger=SVNClientManager.newInstance(SVNWCUtil.createDefaultOptions(true),authManager);
  logger.trace("String_Node_Str" + clientManger);
  return clientManger;
}
Program: 145899
Project: 145899
Buggy source:
/** 
 * Fires the events about updating a teststructure. if the event broker is null, nothing is done.
 * @param testStructure used in the vents to notify the clients.
 */
private void fireEvents(TestStructure testStructure){
  if (eventBroker != null) {
    String eventTopic=TestEditorCoreEventConstants.TESTSTRUCTURE_MODEL_CHANGED_UPDATE_BY_MODIFY;
    eventBroker.post(eventTopic,testStructure.getFullName());
    eventBroker.post(TestEditorCoreEventConstants.TESTSTRUCTURE_STATE_RESET,testStructure.getRootElement().getFullName());
  }
}

Fixed version (ground truth):
/** 
 * Fires the events about updating a teststructure. if the event broker is null, nothing is done.
 * @param testStructure used in the vents to notify the clients.
 */
private void fireEvents(TestStructure testStructure){
  if (eventBroker != null) {
    String eventTopic=TestEditorCoreEventConstants.TESTSTRUCTURE_MODEL_CHANGED_UPDATE_BY_MODIFY;
    eventBroker.post(eventTopic,testStructure.getFullName());
    eventBroker.post(TestEditorCoreEventConstants.TESTSTRUCTURE_STATE_RESET,testStructure.getRootElement().getFullName());
    eventBroker.post(TestEditorCoreEventConstants.TEAMSHARE_UPDATE,testStructure.getRootElement().getFullName());
  }
}
Program: 145900
Project: 145900
Buggy source:
@Override public void rename(TestStructure testStructure,String newName,TranslationService translationService) throws SystemException {
  SVNClientManager clientManager=getSVNClientManager(testStructure.getRootElement());
  SVNMoveClient client=clientManager.getMoveClient();
  File src=getFile(testStructure);
  File dest=new File(src.getParentFile().getAbsolutePath() + File.separator + newName);
  logger.trace("String_Node_Str" + src + "String_Node_Str"+ dest);
  try {
    client.doMove(src,dest);
    updateSvnstate(testStructure);
  }
 catch (  SVNException e) {
    logger.error(e.getMessage(),e);
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
}

Fixed version (ground truth):
@Override public void rename(TestStructure testStructure,String newName,TranslationService translationService) throws SystemException {
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
  SVNClientManager clientManager=getSVNClientManager(testStructure.getRootElement());
  SVNMoveClient client=clientManager.getMoveClient();
  File src=getFile(testStructure);
  File dest=new File(src.getParentFile().getAbsolutePath() + File.separator + newName);
  logger.trace("String_Node_Str" + src + "String_Node_Str"+ dest);
  try {
    client.doMove(src,dest);
    updateSvnstate(testStructure);
  }
 catch (  SVNException e) {
    logger.error(e.getMessage(),e);
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
}
Program: 145901
Project: 145901
Buggy source:
@Override public String approve(TestStructure testStructure,TranslationService translationService,String svnComment) throws SystemException {
  String resultState="String_Node_Str";
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + testStructure.getFullName());
  }
  try {
    TestProject testProject=testStructure.getRootElement();
    SVNClientManager clientManager=getSVNClientManager(testProject);
    SVNWCClient wcClient=clientManager.getWCClient();
    File checkinFile=getFile(testStructure);
    boolean isDir=false;
    if (checkinFile.isDirectory()) {
      isDir=true;
    }
    try {
      wcClient.doAdd(checkinFile,false,isDir,true,SVNDepth.INFINITY,true,true);
    }
 catch (    Exception e) {
      logger.warn(e.getMessage(),e);
    }
    SVNCommitClient cc=clientManager.getCommitClient();
    cc.setEventHandler(new SVNLoggingEventHandler(listener,logger));
    SVNCommitInfo doCommit=cc.doCommit(new File[]{checkinFile},false,svnComment,null,null,false,true,SVNDepth.INFINITY);
    resultState=translationService.translate("String_Node_Str","String_Node_Str") + "String_Node_Str" + doCommit.getNewRevision();
    updateSvnstate(testStructure);
    if (logger.isInfoEnabled()) {
      logger.info("String_Node_Str" + doCommit.toString());
    }
  }
 catch (  SVNException e) {
    logger.error(e.getMessage(),e);
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message);
  }
  return resultState;
}

Fixed version (ground truth):
@Override public String approve(TestStructure testStructure,TranslationService translationService,String svnComment) throws SystemException {
  String resultState="String_Node_Str";
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
  try {
    TestProject testProject=testStructure.getRootElement();
    SVNClientManager clientManager=getSVNClientManager(testProject);
    SVNWCClient wcClient=clientManager.getWCClient();
    File checkinFile=getFile(testStructure);
    boolean isDir=false;
    if (checkinFile.isDirectory()) {
      isDir=true;
    }
    try {
      wcClient.doAdd(checkinFile,false,isDir,true,SVNDepth.INFINITY,true,true);
    }
 catch (    Exception e) {
      logger.warn(e.getMessage(),e);
    }
    SVNCommitClient cc=clientManager.getCommitClient();
    cc.setEventHandler(new SVNLoggingEventHandler(listener,logger));
    SVNCommitInfo doCommit=cc.doCommit(new File[]{checkinFile},false,svnComment,null,null,false,true,SVNDepth.INFINITY);
    resultState=translationService.translate("String_Node_Str","String_Node_Str") + "String_Node_Str" + doCommit.getNewRevision();
    updateSvnstate(testStructure);
    if (logger.isInfoEnabled()) {
      logger.info("String_Node_Str" + doCommit.toString());
    }
  }
 catch (  SVNException e) {
    logger.error(e.getMessage(),e);
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message);
  }
  logger.trace("String_Node_Str" + testStructure.getFullName() + "String_Node_Str");
  return resultState;
}
Program: 145902
Project: 145902
Buggy source:
@Override public void addAdditonalFile(TestStructure testStructure,String fileName) throws SystemException {
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + testStructure.getFullName());
  }
  TestProject testProject=testStructure.getRootElement();
  SVNWCClient wcClient=getSVNClientManager(testProject).getWCClient();
  File file=new File(getFile(testStructure),fileName);
  try {
    final SVNStatus info=getSVNClientManager(testProject).getStatusClient().doStatus(file,false);
    if (!info.isVersioned()) {
      wcClient.doAdd(file,false,false,false,SVNDepth.INFINITY,true,true);
    }
  }
 catch (  Exception e) {
    logger.warn(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void addAdditonalFile(TestStructure testStructure,String fileName) throws SystemException {
  logger.trace("String_Node_Str" + testStructure.getFullName());
  TestProject testProject=testStructure.getRootElement();
  SVNWCClient wcClient=getSVNClientManager(testProject).getWCClient();
  File file=new File(getFile(testStructure),fileName);
  try {
    final SVNStatus info=getSVNClientManager(testProject).getStatusClient().doStatus(file,false);
    if (!info.isVersioned()) {
      wcClient.doAdd(file,false,false,false,SVNDepth.INFINITY,true,true);
    }
  }
 catch (  Exception e) {
    logger.warn(e.getMessage(),e);
  }
  logger.trace("String_Node_Str" + testStructure.getFullName());
}
Program: 145903
Project: 145903
Buggy source:
@Override public void addChild(TestStructure testStructureChild,TranslationService translationService) throws SystemException {
  SVNClientManager clientManager=getSVNClientManager(testStructureChild.getRootElement());
  SVNWCClient wcClient=clientManager.getWCClient();
  File file=getFile(testStructureChild);
  try {
    wcClient.doAdd(file,true,false,false,SVNDepth.FILES,false,false);
    updateSvnstate(testStructureChild);
    if (logger.isTraceEnabled()) {
      logger.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
    }
  }
 catch (  SVNException e) {
    logger.error(e.getMessage());
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
}

Fixed version (ground truth):
@Override public void addChild(TestStructure testStructureChild,TranslationService translationService) throws SystemException {
  logger.trace("String_Node_Str" + testStructureChild.getFullName() + "String_Node_Str");
  SVNClientManager clientManager=getSVNClientManager(testStructureChild.getRootElement());
  SVNWCClient wcClient=clientManager.getWCClient();
  File file=getFile(testStructureChild);
  try {
    logger.trace("String_Node_Str" + file.getAbsolutePath() + "String_Node_Str");
    wcClient.doAdd(file,true,false,false,SVNDepth.FILES,false,false);
    updateSvnstate(testStructureChild);
  }
 catch (  SVNException e) {
    logger.error(e.getMessage(),e);
    String message=substitudeSVNException(e,translationService);
    throw new SystemException(message,e);
  }
  logger.trace("String_Node_Str" + testStructureChild.getFullName() + "String_Node_Str");
}
Program: 145905
Project: 145905
Buggy source:
/** 
 * Initializes Cron Jobs of the Test-Editor. This jobs run in the background and can send events to update the ui.
 */
protected void initTestEditorCronJobs(){
  TeamModificationCheckJob job=ContextInjectionFactory.make(TeamModificationCheckJob.class,context);
  Thread jobRunner=new Thread(job,"String_Node_Str");
  jobRunner.start();
  jobs.add(jobRunner);
  LOGGER.info("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Initializes Cron Jobs of the Test-Editor. This jobs run in the background and can send events to update the ui.
 */
protected void initTestEditorCronJobs(){
}
Program: 145906
Project: 145906
Buggy source:
/** 
 * Init Test Object TestExplorer with the Eclipse Context.
 */
@Before public void initOUT(){
  context=EclipseContextFactory.create();
  context.set(MPart.class,null);
  context.set(ECommandService.class,new ECommandService(){
    @Override public Command getCommand(    String commandId){
      return null;
    }
    @Override public Category getCategory(    String categoryId){
      return null;
    }
    @Override public Command defineCommand(    String id,    String name,    String description,    Category category,    IParameter[] parameters){
      return null;
    }
    @Override public Category defineCategory(    String id,    String name,    String description){
      return null;
    }
    @Override public ParameterizedCommand createCommand(    String id,    Map parameters){
      return null;
    }
  }
);
  context.set(IEventBroker.class,new EventBrokerMock(){
    @Override public boolean send(    String topic,    Object data){
      return true;
    }
    @Override public boolean post(    String topic,    Object data){
      return true;
    }
  }
);
  context.set(EPartService.class,getPartServiceMock());
  context.set(EHandlerService.class,null);
  context.set(TranslationService.class,null);
  context.set(EMenuService.class,null);
  context.set(TestEditorTranslationService.class,null);
  context.set(MWindow.class,null);
  context.set(Logger.class,null);
  context.set(MApplication.class,null);
  context.set(TeamShareStatusService.class,null);
  shell=new Shell();
  composite=new Composite(shell,SWT.NORMAL);
  context.set(Composite.class,composite);
  context.set(TestProjectService.class,getTestProjectMock());
  setRetriveTestStructureCounts(0);
  testExplorer=ContextInjectionFactory.make(TestExplorer.class,context);
}

Fixed version (ground truth):
/** 
 * Init Test Object TestExplorer with the Eclipse Context.
 */
@Before public void initOUT(){
  context=EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(this.getClass()).getBundleContext());
  context.set(MPart.class,null);
  context.set(EPartService.class,getPartServiceMock());
  context.set(EMenuService.class,null);
  context.set(TestEditorTranslationService.class,null);
  context.set(Logger.class,null);
  context.set(TeamShareStatusServiceNew.class,null);
  shell=new Shell();
  composite=new Composite(shell,SWT.NORMAL);
  context.set(Composite.class,composite);
  context.set(TestProjectService.class,getTestProjectMock());
  setRetriveTestStructureCounts(0);
  testExplorer=ContextInjectionFactory.make(TestExplorer.class,context);
}
Program: 145908
Project: 145908
Buggy source:
@Override protected TestStructureTree createTestStructureTree(){
  return new TestStructureTree(){
    @Override public IStructuredSelection getSelection(){
      return new IStructuredSelection(){
        @Override public boolean isEmpty(){
          return false;
        }
        @Override public List toList(){
          return null;
        }
        @Override public Object[] toArray(){
          return null;
        }
        @Override public int size(){
          return 1;
        }
        @Override public Iterator iterator(){
          return null;
        }
        @Override public Object getFirstElement(){
          return testStructure;
        }
      }
;
    }
    @Override public TestStructure getSelectedTestStrucuture(){
      return testStructure;
    }
  }
;
}

Fixed version (ground truth):
@Override protected TestStructureTree createTestStructureTree(){
  TestStructureTree tree=new TestStructureTree(){
    @Override public IStructuredSelection getSelection(){
      return new IStructuredSelection(){
        @Override public boolean isEmpty(){
          return false;
        }
        @Override public List toList(){
          return null;
        }
        @Override public Object[] toArray(){
          return null;
        }
        @Override public int size(){
          return 1;
        }
        @Override public Iterator iterator(){
          return null;
        }
        @Override public Object getFirstElement(){
          return testStructure;
        }
      }
;
    }
    @Override public TestStructure getSelectedTestStrucuture(){
      return testStructure;
    }
  }
;
  ContextInjectionFactory.inject(tree,context);
  return tree;
}
Program: 145909
Project: 145909
Buggy source:
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.create();
  context.set(Shell.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  context.set(TestScenarioService.class,getTestScenarioServiceMock());
  return context;
}

Fixed version (ground truth):
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(getClass()).getBundleContext());
  context.set(Shell.class,null);
  context.set(Logger.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  context.set(TestScenarioService.class,getTestScenarioServiceMock());
  return context;
}
Program: 145910
Project: 145910
Buggy source:
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.create();
  context.set(Shell.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  return context;
}

Fixed version (ground truth):
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(getClass()).getBundleContext());
  context.set(Shell.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  context.set(Logger.class,null);
  return context;
}
Program: 145911
Project: 145911
Buggy source:
@Override public boolean isModified(TestStructure testStructure){
  TeamShareStatusServicePlugIn teamShareStatus=getTeamShareStatusPlugIn(testStructure.getRootElement());
  if (teamShareStatus != null && teamShareStatus != null) {
    return teamShareStatus.isModified(testStructure);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isModified(TestStructure testStructure){
  TeamShareStatusServicePlugIn teamShareStatus=getTeamShareStatusPlugIn(testStructure.getRootElement());
  if (teamShareStatus != null) {
    return teamShareStatus.isModified(testStructure);
  }
  return false;
}
Program: 145912
Project: 145912
Buggy source:
/** 
 * Init Test Object TestExplorer with the Eclipse Context.
 */
@Before public void initOUT(){
  context=EclipseContextFactory.create();
  context.set(MPart.class,null);
  context.set(ECommandService.class,new ECommandService(){
    @Override public Command getCommand(    String commandId){
      return null;
    }
    @Override public Category getCategory(    String categoryId){
      return null;
    }
    @Override public Command defineCommand(    String id,    String name,    String description,    Category category,    IParameter[] parameters){
      return null;
    }
    @Override public Category defineCategory(    String id,    String name,    String description){
      return null;
    }
    @Override public ParameterizedCommand createCommand(    String id,    Map parameters){
      return null;
    }
  }
);
  context.set(IEventBroker.class,new EventBrokerMock(){
    @Override public boolean send(    String topic,    Object data){
      return true;
    }
    @Override public boolean post(    String topic,    Object data){
      return true;
    }
  }
);
  context.set(EPartService.class,getPartServiceMock());
  context.set(EHandlerService.class,null);
  context.set(TranslationService.class,null);
  context.set(EMenuService.class,null);
  context.set(TestEditorTranslationService.class,null);
  context.set(MWindow.class,null);
  context.set(Logger.class,null);
  context.set(MApplication.class,null);
  context.set(TeamShareStatusService.class,null);
  shell=new Shell();
  composite=new Composite(shell,SWT.NORMAL);
  context.set(Composite.class,composite);
  context.set(TestProjectService.class,getTestProjectMock());
  setRetriveTestStructureCounts(0);
  testExplorer=ContextInjectionFactory.make(TestExplorer.class,context);
}

Fixed version (ground truth):
/** 
 * Init Test Object TestExplorer with the Eclipse Context.
 */
@Before public void initOUT(){
  context=EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(this.getClass()).getBundleContext());
  context.set(MPart.class,null);
  context.set(EPartService.class,getPartServiceMock());
  context.set(EMenuService.class,null);
  context.set(TestEditorTranslationService.class,null);
  context.set(Logger.class,null);
  context.set(TeamShareStatusServiceNew.class,null);
  shell=new Shell();
  composite=new Composite(shell,SWT.NORMAL);
  context.set(Composite.class,composite);
  context.set(TestProjectService.class,getTestProjectMock());
  setRetriveTestStructureCounts(0);
  testExplorer=ContextInjectionFactory.make(TestExplorer.class,context);
}
Program: 145914
Project: 145914
Buggy source:
@Override protected TestStructureTree createTestStructureTree(){
  return new TestStructureTree(){
    @Override public IStructuredSelection getSelection(){
      return new IStructuredSelection(){
        @Override public boolean isEmpty(){
          return false;
        }
        @Override public List toList(){
          return null;
        }
        @Override public Object[] toArray(){
          return null;
        }
        @Override public int size(){
          return 1;
        }
        @Override public Iterator iterator(){
          return null;
        }
        @Override public Object getFirstElement(){
          return testStructure;
        }
      }
;
    }
    @Override public TestStructure getSelectedTestStrucuture(){
      return testStructure;
    }
  }
;
}

Fixed version (ground truth):
@Override protected TestStructureTree createTestStructureTree(){
  TestStructureTree tree=new TestStructureTree(){
    @Override public IStructuredSelection getSelection(){
      return new IStructuredSelection(){
        @Override public boolean isEmpty(){
          return false;
        }
        @Override public List toList(){
          return null;
        }
        @Override public Object[] toArray(){
          return null;
        }
        @Override public int size(){
          return 1;
        }
        @Override public Iterator iterator(){
          return null;
        }
        @Override public Object getFirstElement(){
          return testStructure;
        }
      }
;
    }
    @Override public TestStructure getSelectedTestStrucuture(){
      return testStructure;
    }
  }
;
  ContextInjectionFactory.inject(tree,context);
  return tree;
}
Program: 145915
Project: 145915
Buggy source:
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.create();
  context.set(Shell.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  context.set(TestScenarioService.class,getTestScenarioServiceMock());
  return context;
}

Fixed version (ground truth):
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(getClass()).getBundleContext());
  context.set(Shell.class,null);
  context.set(Logger.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  context.set(TestScenarioService.class,getTestScenarioServiceMock());
  return context;
}
Program: 145916
Project: 145916
Buggy source:
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.create();
  context.set(Shell.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  return context;
}

Fixed version (ground truth):
/** 
 * @return the IEclipseContext for the test.
 */
private IEclipseContext getContext(){
  IEclipseContext context=EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(getClass()).getBundleContext());
  context.set(Shell.class,null);
  context.set(TestStructureService.class,ServiceLookUpForTest.getService(TestStructureService.class));
  context.set(TestEditorTranslationService.class,getTranslationServiceMock());
  context.set(TestProjectService.class,ServiceLookUpForTest.getService(TestProjectService.class));
  context.set(TestEditorReservedNamesService.class,getTestEditorReservedNamesServiceMock());
  context.set(Logger.class,null);
  return context;
}
Program: 145917
Project: 145917
Buggy source:
/** 
 * Returns true if the name is valid.
 * @param name of the Testflow
 * @return true if name is valid
 */
protected boolean isNameValid(String name){
  this.setMessage(null);
  if (name == null || name.isEmpty()) {
    return false;
  }
  if (getSelectedTestStrucutureElement() == null) {
    return false;
  }
  if (testEditorReservedNamesService.isReservedName(name) || testStructureService.isReservedName(getSelectedTestStrucutureElement().getRootElement(),name)) {
    this.setErrorMessage(name + "String_Node_Str" + translationService.translate("String_Node_Str"));
    return false;
  }
  if (!NAME_PATTERN.matcher(name).matches()) {
    this.setErrorMessage(translationService.translate("String_Node_Str"));
    return false;
  }
  if (getSelectedTestStrucutureElement() != null) {
    selectedTS=getSelectedTestStrucutureElement();
  }
  if (getNameInspector().isNameValid(name)) {
    setErrorMessage(null);
    return true;
  }
 else {
    setErrorMessage(getNameInspector().nameInvalideMessage());
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Returns true if the name is valid.
 * @param name of the Testflow
 * @return true if name is valid
 */
protected boolean isNameValid(String name){
  this.setMessage(null);
  if (name == null || name.isEmpty()) {
    return false;
  }
  if (isReservedName(name)) {
    this.setErrorMessage(name + "String_Node_Str" + translationService.translate("String_Node_Str"));
    return false;
  }
  if (!NAME_PATTERN.matcher(name).matches()) {
    this.setErrorMessage(translationService.translate("String_Node_Str"));
    return false;
  }
  if (getSelectedTestStrucutureElement() != null) {
    selectedTS=getSelectedTestStrucutureElement();
  }
  if (getNameInspector().isNameValid(name)) {
    setErrorMessage(null);
    return true;
  }
 else {
    setErrorMessage(getNameInspector().nameInvalideMessage());
    return false;
  }
}
Program: 145918
Project: 145918
Buggy source:
/** 
 * Returns true if the name is valid.
 * @param name of the Testflow
 * @return true if name is valid
 */
protected boolean isNameValid(String name){
  this.setMessage(null);
  if (name == null || name.isEmpty()) {
    return false;
  }
  if (getSelectedTestStrucutureElement() == null) {
    return false;
  }
  if (testEditorReservedNamesService.isReservedName(name) || testStructureService.isReservedName(getSelectedTestStrucutureElement().getRootElement(),name)) {
    this.setErrorMessage(name + "String_Node_Str" + translationService.translate("String_Node_Str"));
    return false;
  }
  if (!NAME_PATTERN.matcher(name).matches()) {
    this.setErrorMessage(translationService.translate("String_Node_Str"));
    return false;
  }
  if (getSelectedTestStrucutureElement() != null) {
    selectedTS=getSelectedTestStrucutureElement();
  }
  if (getNameInspector().isNameValid(name)) {
    setErrorMessage(null);
    return true;
  }
 else {
    setErrorMessage(getNameInspector().nameInvalideMessage());
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Returns true if the name is valid.
 * @param name of the Testflow
 * @return true if name is valid
 */
protected boolean isNameValid(String name){
  this.setMessage(null);
  if (name == null || name.isEmpty()) {
    return false;
  }
  if (isReservedName(name)) {
    this.setErrorMessage(name + "String_Node_Str" + translationService.translate("String_Node_Str"));
    return false;
  }
  if (!NAME_PATTERN.matcher(name).matches()) {
    this.setErrorMessage(translationService.translate("String_Node_Str"));
    return false;
  }
  if (getSelectedTestStrucutureElement() != null) {
    selectedTS=getSelectedTestStrucutureElement();
  }
  if (getNameInspector().isNameValid(name)) {
    setErrorMessage(null);
    return true;
  }
 else {
    setErrorMessage(getNameInspector().nameInvalideMessage());
    return false;
  }
}
Program: 145919
Project: 145919
Buggy source:
/** 
 * Returns true if the name is valid.
 * @param name of the Testflow
 * @return true if name is valid
 */
protected boolean isNameValid(String name){
  this.setMessage(null);
  if (name == null || name.isEmpty()) {
    return false;
  }
  if (getSelectedTestStrucutureElement() == null) {
    return false;
  }
  if (testEditorReservedNamesService.isReservedName(name) || testStructureService.isReservedName(getSelectedTestStrucutureElement().getRootElement(),name)) {
    this.setErrorMessage(name + "String_Node_Str" + translationService.translate("String_Node_Str"));
    return false;
  }
  if (!NAME_PATTERN.matcher(name).matches()) {
    this.setErrorMessage(translationService.translate("String_Node_Str"));
    return false;
  }
  if (getSelectedTestStrucutureElement() != null) {
    selectedTS=getSelectedTestStrucutureElement();
  }
  if (getNameInspector().isNameValid(name)) {
    setErrorMessage(null);
    return true;
  }
 else {
    setErrorMessage(getNameInspector().nameInvalideMessage());
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Returns true if the name is valid.
 * @param name of the Testflow
 * @return true if name is valid
 */
protected boolean isNameValid(String name){
  this.setMessage(null);
  if (name == null || name.isEmpty()) {
    return false;
  }
  if (isReservedName(name)) {
    this.setErrorMessage(name + "String_Node_Str" + translationService.translate("String_Node_Str"));
    return false;
  }
  if (!NAME_PATTERN.matcher(name).matches()) {
    this.setErrorMessage(translationService.translate("String_Node_Str"));
    return false;
  }
  if (getSelectedTestStrucutureElement() != null) {
    selectedTS=getSelectedTestStrucutureElement();
  }
  if (getNameInspector().isNameValid(name)) {
    setErrorMessage(null);
    return true;
  }
 else {
    setErrorMessage(getNameInspector().nameInvalideMessage());
    return false;
  }
}
Program: 145923
Project: 145923
Buggy source:
/** 
 * Sets the metadatatags of the current testFlow. The method must be called to setup the table containing the metatagtable.
 * @param testFlow - the testFlow
 */
public void setTestFlow(TestFlow testFlow){
  this.testFlow=testFlow;
  metaDataTagList.clear();
  metaDataTagList.addAll(getMetaDataService().getMetaDataTags(testFlow));
  if (metaDataTagList.size() == 0) {
    Label lblMessage=new Label(composite,SWT.NONE);
    String message="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    lblMessage.setText(message);
    metaDataCB.getCombo().setVisible(false);
    lblMetaDataCB.setVisible(false);
    metaDataTagsTable.setVisible(false);
  }
 else {
    for (    MetaData metaData : getMetaDataService().getAllMetaData(testFlow.getRootElement())) {
      metaDataCB.add(metaData);
    }
    metaDataCB.getCombo().pack(true);
    metaDataCB.getCombo().getParent().pack(true);
    for (    MetaDataTag metaDataTag : metaDataTagList) {
      MetaDataValue metaDataValue=getMetaDataService().getMetaDataValue(metaDataTag,testFlow.getRootElement());
      TableItem tableRow=new TableItem(metaDataTagsTable,SWT.NONE);
      tableRow.setText(0,metaDataValue.getMetaData().getLabel());
      tableRow.setText(1,metaDataValue.getLabel());
      tableRow.setImage(2,IconConstants.ICON_DELETE);
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets the metadatatags of the current testFlow. The method must be called to setup the table containing the metatagtable.
 * @param testFlow - the testFlow
 */
public void setTestFlow(TestFlow testFlow){
  this.testFlow=testFlow;
  metaDataTagList.clear();
  metaDataTagList.addAll(getMetaDataService().getMetaDataTags(testFlow));
  List<MetaData> metaDataList=getMetaDataService().getAllMetaData(testFlow.getRootElement());
  if (metaDataList.size() == 0) {
    Label lblMessage=new Label(composite,SWT.NONE);
    String message="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    lblMessage.setText(message);
    metaDataCB.getCombo().setVisible(false);
    lblMetaDataCB.setVisible(false);
    metaDataTagsTable.setVisible(false);
  }
 else {
    for (    MetaData metaData : metaDataList) {
      metaDataCB.add(metaData);
    }
    metaDataCB.getCombo().pack(true);
    metaDataCB.getCombo().getParent().pack(true);
    for (    MetaDataTag metaDataTag : metaDataTagList) {
      MetaDataValue metaDataValue=getMetaDataService().getMetaDataValue(metaDataTag,testFlow.getRootElement());
      TableItem tableRow=new TableItem(metaDataTagsTable,SWT.NONE);
      tableRow.setText(0,metaDataValue.getMetaData().getLabel());
      tableRow.setText(1,metaDataValue.getLabel());
      tableRow.setImage(2,IconConstants.ICON_DELETE);
    }
  }
}
Program: 145924
Project: 145924
Buggy source:
/** 
 * Sets the metadatatags of the current testFlow. The method must be called to setup the table containing the metatagtable.
 * @param testFlow - the testFlow
 */
public void setTestFlow(TestFlow testFlow){
  this.testFlow=testFlow;
  metaDataTagList.clear();
  metaDataTagList.addAll(getMetaDataService().getMetaDataTags(testFlow));
  if (metaDataTagList.size() == 0) {
    Label lblMessage=new Label(composite,SWT.NONE);
    String message="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    lblMessage.setText(message);
    metaDataCB.getCombo().setVisible(false);
    lblMetaDataCB.setVisible(false);
    metaDataTagsTable.setVisible(false);
  }
 else {
    for (    MetaData metaData : getMetaDataService().getAllMetaData(testFlow.getRootElement())) {
      metaDataCB.add(metaData);
    }
    metaDataCB.getCombo().pack(true);
    metaDataCB.getCombo().getParent().pack(true);
    for (    MetaDataTag metaDataTag : metaDataTagList) {
      MetaDataValue metaDataValue=getMetaDataService().getMetaDataValue(metaDataTag,testFlow.getRootElement());
      TableItem tableRow=new TableItem(metaDataTagsTable,SWT.NONE);
      tableRow.setText(0,metaDataValue.getMetaData().getLabel());
      tableRow.setText(1,metaDataValue.getLabel());
      tableRow.setImage(2,IconConstants.ICON_DELETE);
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets the metadatatags of the current testFlow. The method must be called to setup the table containing the metatagtable.
 * @param testFlow - the testFlow
 */
public void setTestFlow(TestFlow testFlow){
  this.testFlow=testFlow;
  metaDataTagList.clear();
  metaDataTagList.addAll(getMetaDataService().getMetaDataTags(testFlow));
  List<MetaData> metaDataList=getMetaDataService().getAllMetaData(testFlow.getRootElement());
  if (metaDataList.size() == 0) {
    Label lblMessage=new Label(composite,SWT.NONE);
    String message="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    lblMessage.setText(message);
    metaDataCB.getCombo().setVisible(false);
    lblMetaDataCB.setVisible(false);
    metaDataTagsTable.setVisible(false);
  }
 else {
    for (    MetaData metaData : metaDataList) {
      metaDataCB.add(metaData);
    }
    metaDataCB.getCombo().pack(true);
    metaDataCB.getCombo().getParent().pack(true);
    for (    MetaDataTag metaDataTag : metaDataTagList) {
      MetaDataValue metaDataValue=getMetaDataService().getMetaDataValue(metaDataTag,testFlow.getRootElement());
      TableItem tableRow=new TableItem(metaDataTagsTable,SWT.NONE);
      tableRow.setText(0,metaDataValue.getMetaData().getLabel());
      tableRow.setText(1,metaDataValue.getLabel());
      tableRow.setImage(2,IconConstants.ICON_DELETE);
    }
  }
}
Program: 145925
Project: 145925
Buggy source:
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) && (rules.canExecuteOnTestProjectRule(explorer) & ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}

Fixed version (ground truth):
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) && (rules.canExecuteOnTestProjectRule(explorer) && ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}
Program: 145926
Project: 145926
Buggy source:
/** 
 * clear the selection in the combobox.
 */
public void clearSelection(){
  wrappedCombo.deselectAll();
  wrappedCombo.clearSelection();
  wrappedCombo.redraw();
}

Fixed version (ground truth):
/** 
 * clear the selection in the combobox.
 */
public void clearSelection(){
  wrappedCombo.deselectAll();
  wrappedCombo.clearSelection();
  wrappedCombo.setText("String_Node_Str");
  wrappedCombo.redraw();
}
Program: 145927
Project: 145927
Buggy source:
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) && (rules.canExecuteOnTestProjectRule(explorer) & ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}

Fixed version (ground truth):
@Override @Execute public boolean canExecute(IEclipseContext context){
  TestExplorer explorer=(TestExplorer)context.get(TestEditorConstants.TEST_EXPLORER_VIEW);
  CanExecuteTestExplorerHandlerRules rules=ContextInjectionFactory.make(CanExecuteTestExplorerHandlerRules.class,context);
  return super.canExecute(context) && (rules.canExecuteOnTestProjectRule(explorer) && ((TestStructure)explorer.getSelection().getFirstElement()).getRootElement().getTestProjectConfig().getTeamShareConfig() == null);
}
Program: 145928
Project: 145928
Buggy source:
/** 
 * clear the selection in the combobox.
 */
public void clearSelection(){
  wrappedCombo.deselectAll();
  wrappedCombo.clearSelection();
  wrappedCombo.redraw();
}

Fixed version (ground truth):
/** 
 * clear the selection in the combobox.
 */
public void clearSelection(){
  wrappedCombo.deselectAll();
  wrappedCombo.clearSelection();
  wrappedCombo.setText("String_Node_Str");
  wrappedCombo.redraw();
}