nus-yam/ex-repair huggingface dataset:
Program: 117940
Project: 117940
Buggy source:
@Override public List<IComponent> filterNeededComponents(Item item,RepositoryNode seletetedNode,ERepositoryObjectType type){
  List<IComponent> neededComponents=new ArrayList<IComponent>();
  if (!(item instanceof JSONFileConnectionItem)) {
    return neededComponents;
  }
  IComponentsService service=(IComponentsService)GlobalServiceRegister.getDefault().getService(IComponentsService.class);
  Set<IComponent> components=service.getComponentsFactory().getComponents();
  JSONFileConnection connection=(JSONFileConnection)((JSONFileConnectionItem)item).getConnection();
  for (  IComponent component : components) {
    if (!connection.isInputModel()) {
      if (isValid(item,type,seletetedNode,component,"String_Node_Str") && !neededComponents.contains(component)) {
        neededComponents.add(component);
      }
    }
 else {
      if (isValid(item,type,seletetedNode,component,JSON) && !neededComponents.contains(component)) {
        neededComponents.add(component);
      }
    }
  }
  return neededComponents;
}

Fixed version (ground truth):
@Override public List<IComponent> filterNeededComponents(Item item,RepositoryNode seletetedNode,ERepositoryObjectType type){
  List<IComponent> neededComponents=new ArrayList<IComponent>();
  if (!(item instanceof JSONFileConnectionItem)) {
    return neededComponents;
  }
  IComponentsService service=(IComponentsService)GlobalServiceRegister.getDefault().getService(IComponentsService.class);
  Collection<IComponent> components=service.getComponentsFactory().readComponents();
  JSONFileConnection connection=(JSONFileConnection)((JSONFileConnectionItem)item).getConnection();
  for (  IComponent component : components) {
    if (!connection.isInputModel()) {
      if (isValid(item,type,seletetedNode,component,"String_Node_Str") && !neededComponents.contains(component)) {
        neededComponents.add(component);
      }
    }
 else {
      if (isValid(item,type,seletetedNode,component,JSON) && !neededComponents.contains(component)) {
        neededComponents.add(component);
      }
    }
  }
  return neededComponents;
}
Program: 117941
Project: 117941
Buggy source:
/** 
 * yzhang Comment method "resetFamily".
 * @param list
 */
private void resetFamily(EList list){
  IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
  Set<IComponent> components=componentsFactory.getComponents();
  list.clear();
  for (  IComponent component : components) {
    String[] families=component.getOriginalFamilyName().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
    for (    String family : families) {
      ComponentSetting setting=PropertiesFactory.eINSTANCE.createComponentSetting();
      setting.setFamily(family);
      setting.setName(component.getName());
      setting.setHidden(!component.isVisibleInComponentDefinition());
      list.add(setting);
    }
  }
  RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
  IProxyRepositoryFactory prf=CorePlugin.getDefault().getProxyRepositoryFactory();
  try {
    prf.saveProject(repositoryContext.getProject());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
/** 
 * yzhang Comment method "resetFamily".
 * @param list
 */
private void resetFamily(EList list){
  IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
  Collection<IComponent> components=componentsFactory.readComponents();
  list.clear();
  for (  IComponent component : components) {
    String[] families=component.getOriginalFamilyName().split(ComponentsFactoryProvider.FAMILY_SEPARATOR_REGEX);
    for (    String family : families) {
      ComponentSetting setting=PropertiesFactory.eINSTANCE.createComponentSetting();
      setting.setFamily(family);
      setting.setName(component.getName());
      setting.setHidden(!component.isVisibleInComponentDefinition());
      list.add(setting);
    }
  }
  RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
  IProxyRepositoryFactory prf=CorePlugin.getDefault().getProxyRepositoryFactory();
  try {
    prf.saveProject(repositoryContext.getProject());
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 117942
Project: 117942
Buggy source:
public Date getOrder(){
  GregorianCalendar gc=new GregorianCalendar(2008,7,7,13,0,0);
  return gc.getTime();
}

Fixed version (ground truth):
@Override public Date getOrder(){
  GregorianCalendar gc=new GregorianCalendar(2008,7,7,13,0,0);
  return gc.getTime();
}
Program: 117943
Project: 117943
Buggy source:
public ExecutionResult execute(Project project){
  boolean needReset=false;
  EList list=project.getEmfProject().getComponentsSettings();
  for (  Object obj : list) {
    ComponentSetting componentSetting=(ComponentSetting)obj;
    if (componentSetting.getFamily() == null) {
      needReset=true;
      break;
    }
  }
  if (needReset) {
    resetFamily(list);
  }
  return ExecutionResult.SUCCESS_WITH_ALERT;
}

Fixed version (ground truth):
@Override public ExecutionResult execute(Project project){
  boolean needReset=false;
  EList list=project.getEmfProject().getComponentsSettings();
  for (  Object obj : list) {
    ComponentSetting componentSetting=(ComponentSetting)obj;
    if (componentSetting.getFamily() == null) {
      needReset=true;
      break;
    }
  }
  if (needReset) {
    resetFamily(list);
  }
  return ExecutionResult.SUCCESS_WITH_ALERT;
}
Program: 117944
Project: 117944
Buggy source:
@Override public ExecutionResult execute(Project project){
  List<ComponentSetting> components=project.getEmfProject().getComponentsSettings();
  List<ComponentSetting> newAdded=new ArrayList<ComponentSetting>();
  Set<IComponent> componentList=ComponentsFactoryProvider.getInstance().getComponents();
  for (  ComponentSetting componentSetting : components) {
    for (    IComponent comp : componentList) {
      if (comp != null && comp.getName().equals(componentSetting.getName())) {
        componentSetting.setName(comp.getPaletteType() + "String_Node_Str" + comp.getName());
        String family=componentSetting.getFamily();
        if (family.contains("String_Node_Str")) {
          String[] fams=family.split("String_Node_Str");
          for (int i=0; i < fams.length; i++) {
            if (i == 0) {
              componentSetting.setFamily(fams[0]);
            }
 else {
              ComponentSetting cs=PropertiesFactory.eINSTANCE.createComponentSetting();
              cs.setName(comp.getPaletteType() + "String_Node_Str" + comp.getName());
              cs.setHidden(componentSetting.isHidden());
              cs.setFamily(fams[i]);
              newAdded.add(cs);
            }
          }
        }
        break;
      }
    }
  }
  components.addAll(newAdded);
  return ExecutionResult.SUCCESS_NO_ALERT;
}

Fixed version (ground truth):
@Override public ExecutionResult execute(Project project){
  List<ComponentSetting> components=project.getEmfProject().getComponentsSettings();
  List<ComponentSetting> newAdded=new ArrayList<ComponentSetting>();
  Collection<IComponent> componentList=ComponentsFactoryProvider.getInstance().readComponents();
  for (  ComponentSetting componentSetting : components) {
    for (    IComponent comp : componentList) {
      if (comp != null && comp.getName().equals(componentSetting.getName())) {
        componentSetting.setName(comp.getPaletteType() + "String_Node_Str" + comp.getName());
        String family=componentSetting.getFamily();
        if (family.contains("String_Node_Str")) {
          String[] fams=family.split("String_Node_Str");
          for (int i=0; i < fams.length; i++) {
            if (i == 0) {
              componentSetting.setFamily(fams[0]);
            }
 else {
              ComponentSetting cs=PropertiesFactory.eINSTANCE.createComponentSetting();
              cs.setName(comp.getPaletteType() + "String_Node_Str" + comp.getName());
              cs.setHidden(componentSetting.isHidden());
              cs.setFamily(fams[i]);
              newAdded.add(cs);
            }
          }
        }
        break;
      }
    }
  }
  components.addAll(newAdded);
  return ExecutionResult.SUCCESS_NO_ALERT;
}
Program: 117945
Project: 117945
Buggy source:
public static List<IPaletteItem> buildFullPaletteItemList(){
  List<IPaletteItem> paletteItems=new ArrayList<IPaletteItem>();
  Set<IComponent> components=ComponentsFactoryProvider.getInstance().getComponents();
  for (  IComponent component : components) {
    if (component.isTechnical() || component.getComponentType() == EComponentType.JOBLET) {
      continue;
    }
    createPaletteItems(component,paletteItems);
  }
  return paletteItems;
}

Fixed version (ground truth):
public static List<IPaletteItem> buildFullPaletteItemList(){
  List<IPaletteItem> paletteItems=new ArrayList<IPaletteItem>();
  Collection<IComponent> components=ComponentsFactoryProvider.getInstance().readComponents();
  for (  IComponent component : components) {
    if (component.isTechnical() || component.getComponentType() == EComponentType.JOBLET) {
      continue;
    }
    createPaletteItems(component,paletteItems);
  }
  return paletteItems;
}
Program: 117946
Project: 117946
Buggy source:
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    monitor.beginTask("String_Node_Str",1100);
    IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
    Set<IComponent> components=componentsFactory.getComponents();
    monitor.worked(100);
    RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
    ECodeLanguage codeLanguage=repositoryContext.getProject().getLanguage();
    String path=getPath();
    int taskTotal=components.size();
    for (    IComponent component : components) {
      String templateURI=path + File.separatorChar + component.getName()+ File.separatorChar+ TestParameter.GENERATE_TEST;
      File templateFile=new File(templateURI);
      if (templateFile.exists()) {
        File[] fileArray=getFile(templateFile,codeLanguage);
        generateCode(fileArray,templateURI.replace("String_Node_Str","String_Node_Str"));
      }
      monitor.worked(1 * 1000 / taskTotal);
    }
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  monitor.done();
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override protected IStatus run(IProgressMonitor monitor){
  try {
    monitor.beginTask("String_Node_Str",1100);
    IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
    Collection<IComponent> components=componentsFactory.readComponents();
    monitor.worked(100);
    RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
    ECodeLanguage codeLanguage=repositoryContext.getProject().getLanguage();
    String path=getPath();
    int taskTotal=components.size();
    for (    IComponent component : components) {
      String templateURI=path + File.separatorChar + component.getName()+ File.separatorChar+ TestParameter.GENERATE_TEST;
      File templateFile=new File(templateURI);
      if (templateFile.exists()) {
        File[] fileArray=getFile(templateFile,codeLanguage);
        generateCode(fileArray,templateURI.replace("String_Node_Str","String_Node_Str"));
      }
      monitor.worked(1 * 1000 / taskTotal);
    }
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  monitor.done();
  return Status.OK_STATUS;
}
Program: 117947
Project: 117947
Buggy source:
public void initialize(){
  Job job=new Job("String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      try {
        monitor.beginTask("String_Node_Str",1100);
        IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
        Set<IComponent> components=componentsFactory.getComponents();
        monitor.worked(100);
        RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
        ECodeLanguage codeLanguage=repositoryContext.getProject().getLanguage();
        String path=getPath();
        int taskTotal=components.size();
        for (        IComponent component : components) {
          String templateURI=path + File.separatorChar + component.getName()+ File.separatorChar+ TestParameter.GENERATE_TEST;
          File templateFile=new File(templateURI);
          if (templateFile.exists()) {
            File[] fileArray=getFile(templateFile,codeLanguage);
            generateCode(fileArray,templateURI.replace("String_Node_Str","String_Node_Str"));
          }
          monitor.worked(1 * 1000 / taskTotal);
        }
      }
 catch (      Exception e) {
        log.error("String_Node_Str",e);
      }
      monitor.done();
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
}

Fixed version (ground truth):
public void initialize(){
  Job job=new Job("String_Node_Str"){
    @Override protected IStatus run(    IProgressMonitor monitor){
      try {
        monitor.beginTask("String_Node_Str",1100);
        IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
        Collection<IComponent> components=componentsFactory.readComponents();
        monitor.worked(100);
        RepositoryContext repositoryContext=(RepositoryContext)CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
        ECodeLanguage codeLanguage=repositoryContext.getProject().getLanguage();
        String path=getPath();
        int taskTotal=components.size();
        for (        IComponent component : components) {
          String templateURI=path + File.separatorChar + component.getName()+ File.separatorChar+ TestParameter.GENERATE_TEST;
          File templateFile=new File(templateURI);
          if (templateFile.exists()) {
            File[] fileArray=getFile(templateFile,codeLanguage);
            generateCode(fileArray,templateURI.replace("String_Node_Str","String_Node_Str"));
          }
          monitor.worked(1 * 1000 / taskTotal);
        }
      }
 catch (      Exception e) {
        log.error("String_Node_Str",e);
      }
      monitor.done();
      return Status.OK_STATUS;
    }
  }
;
  job.schedule();
}
Program: 117955
Project: 117955
Buggy source:
private void init(boolean duringLogon){
  removeOldComponentsUserFolder();
  long startTime=System.currentTimeMillis();
  needInstalledNewCFComponents=new JSONObject();
  componentList=Collections.synchronizedSet(new HashSet<IComponent>());
  customComponentList=new HashSet<IComponent>();
  skeletonList=new ArrayList<String>();
  userComponentList=new HashSet<IComponent>();
  String installLocation=new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
  componentToProviderMap=new HashMap<IComponent,AbstractComponentsProvider>();
  boolean isNeedClean=!cleanDone && TalendCacheUtils.isSetCleanComponentCache();
  cleanDone=true;
  isCreated=hasComponentFile(installLocation) && !isNeedClean;
  ComponentsCache cache=ComponentManager.getComponentCache();
  try {
    if (isCreated) {
      if (cache.getComponentEntryMap().isEmpty()) {
        ComponentsCache loadCache=loadComponentResource(installLocation);
        cache.getComponentEntryMap().putAll(loadCache.getComponentEntryMap());
      }
    }
 else {
      cache.getComponentEntryMap().clear();
    }
  }
 catch (  IOException e) {
    ExceptionHandler.process(e);
    cache.getComponentEntryMap().clear();
    isCreated=false;
  }
  loadComponentsFromComponentsProviderExtension();
  loadComponentsFromExtensions();
  ComponentManager.saveResource();
  initComponentNameMap();
  installNewCFComponents();
  log.debug(componentList.size() + "String_Node_Str" + (System.currentTimeMillis() - startTime)+ "String_Node_Str");
}

Fixed version (ground truth):
private void init(boolean duringLogon){
  removeOldComponentsUserFolder();
  long startTime=System.currentTimeMillis();
  resetNewComponentsCache();
  componentList=Collections.synchronizedSet(new HashSet<IComponent>());
  customComponentList=new HashSet<IComponent>();
  skeletonList=new ArrayList<String>();
  userComponentList=new HashSet<IComponent>();
  String installLocation=new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
  componentToProviderMap=new HashMap<IComponent,AbstractComponentsProvider>();
  boolean isNeedClean=!cleanDone && TalendCacheUtils.isSetCleanComponentCache();
  cleanDone=true;
  isCreated=hasComponentFile(installLocation) && !isNeedClean;
  ComponentsCache cache=ComponentManager.getComponentCache();
  try {
    if (isCreated) {
      if (cache.getComponentEntryMap().isEmpty()) {
        ComponentsCache loadCache=loadComponentResource(installLocation);
        cache.getComponentEntryMap().putAll(loadCache.getComponentEntryMap());
      }
    }
 else {
      cache.getComponentEntryMap().clear();
    }
  }
 catch (  IOException e) {
    ExceptionHandler.process(e);
    cache.getComponentEntryMap().clear();
    isCreated=false;
  }
  loadComponentsFromComponentsProviderExtension();
  loadComponentsFromExtensions();
  ComponentManager.saveResource();
  initComponentNameMap();
  installNewCFComponents();
  log.debug(componentList.size() + "String_Node_Str" + (System.currentTimeMillis() - startTime)+ "String_Node_Str");
}
Program: 117956
Project: 117956
Buggy source:
@Override public void reset(){
  componentList=null;
  skeletonList=null;
  customComponentList=null;
  Collection<IComponentFactoryFilter> filters=ComponentsFactoryProviderManager.getInstance().getProviders();
  for (  IComponentFactoryFilter filter : filters) {
    filter.cleanCache();
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
    IJobletProviderService jobletService=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    if (jobletService != null) {
      jobletService.clearJobletComponent();
    }
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
    ISparkJobletProviderService jobletService=(ISparkJobletProviderService)GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
    if (jobletService != null) {
      jobletService.clearSparkJobletComponent();
    }
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
    ISparkStreamingJobletProviderService jobletService=(ISparkStreamingJobletProviderService)GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
    if (jobletService != null) {
      jobletService.clearSparkStreamingJobletComponent();
    }
  }
}

Fixed version (ground truth):
@Override public void reset(){
  componentList=null;
  skeletonList=null;
  customComponentList=null;
  resetNewComponentsCache();
  Collection<IComponentFactoryFilter> filters=ComponentsFactoryProviderManager.getInstance().getProviders();
  for (  IComponentFactoryFilter filter : filters) {
    filter.cleanCache();
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(IJobletProviderService.class)) {
    IJobletProviderService jobletService=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
    if (jobletService != null) {
      jobletService.clearJobletComponent();
    }
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
    ISparkJobletProviderService jobletService=(ISparkJobletProviderService)GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
    if (jobletService != null) {
      jobletService.clearSparkJobletComponent();
    }
  }
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
    ISparkStreamingJobletProviderService jobletService=(ISparkStreamingJobletProviderService)GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
    if (jobletService != null) {
      jobletService.clearSparkStreamingJobletComponent();
    }
  }
}
Program: 117958
Project: 117958
Buggy source:
@BeforeClass public static void prepare() throws IOException {
  backupFolder=FileUtils.createTmpFolder("String_Node_Str","String_Node_Str");
  UserComponentsProviderTestClass provider=new UserComponentsProviderTestClass();
  File installationFolder=provider.getInstallationFolder();
  if (installationFolder != null && installationFolder.exists()) {
    FilesUtils.copyFolder(installationFolder,backupFolder,false,null,null,true);
  }
}

Fixed version (ground truth):
@BeforeClass public static void prepare() throws IOException {
  backupFolder=FileUtils.createTmpFolder("String_Node_Str","String_Node_Str");
  UserComponentsProviderTestClass provider=new UserComponentsProviderTestClass();
  File installationFolder=provider.getInstallationFolder();
  if (installationFolder != null && installationFolder.exists()) {
    FilesUtils.copyFolder(installationFolder,backupFolder,false,null,null,true);
  }
  cleanInstalledSetting();
  cleanComponentFactorySetting();
}
Program: 117959
Project: 117959
Buggy source:
@AfterClass public static void restore() throws IOException {
  UserComponentsProviderTestClass provider=new UserComponentsProviderTestClass();
  File installationFolder=provider.getInstallationFolder();
  if (installationFolder != null && installationFolder.exists()) {
    FilesUtils.copyFolder(backupFolder,installationFolder,true,null,null,true);
  }
}

Fixed version (ground truth):
@AfterClass public static void restore() throws IOException {
  UserComponentsProviderTestClass provider=new UserComponentsProviderTestClass();
  File installationFolder=provider.getInstallationFolder();
  if (installationFolder != null && installationFolder.exists()) {
    FilesUtils.copyFolder(backupFolder,installationFolder,true,null,null,true);
  }
  cleanInstalledSetting();
  cleanComponentFactorySetting();
}
Program: 117960
Project: 117960
Buggy source:
@After public void clean(){
  if (workFolder != null) {
    FilesUtils.deleteFolder(workFolder,true);
  }
  CodeGeneratorActivator.getDefault().getPreferenceStore().setValue(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS,new JSONArray().toString());
}

Fixed version (ground truth):
@After public void clean(){
  if (workFolder != null) {
    FilesUtils.deleteFolder(workFolder,true);
  }
  cleanInstalledSetting();
}
Program: 117961
Project: 117961
Buggy source:
@Before public void setup() throws Exception {
  workFolder=FileUtils.createTmpFolder("String_Node_Str","String_Node_Str");
  CodeGeneratorActivator.getDefault().getPreferenceStore().setValue(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS,new JSONArray().toString());
  final Project currentProject=ProjectManager.getInstance().getCurrentProject();
  final IProject project=ResourceUtils.getProject(currentProject);
  final IFolder projectComponentsFolder=project.getFolder(ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS));
  if (projectComponentsFolder.exists()) {
    FilesUtils.deleteFolder(projectComponentsFolder.getLocation().toFile(),false);
  }
  projectComponentsFolder.refreshLocal(IResource.DEPTH_INFINITE,null);
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  workFolder=FileUtils.createTmpFolder("String_Node_Str","String_Node_Str");
  cleanInstalledSetting();
  final Project currentProject=ProjectManager.getInstance().getCurrentProject();
  final IProject project=ResourceUtils.getProject(currentProject);
  final IFolder projectComponentsFolder=project.getFolder(ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS));
  if (projectComponentsFolder.exists()) {
    FilesUtils.deleteFolder(projectComponentsFolder.getLocation().toFile(),false);
  }
  projectComponentsFolder.refreshLocal(IResource.DEPTH_INFINITE,null);
}
Program: 117962
Project: 117962
Buggy source:
@Override protected void createFieldEditors(){
  version=JavaUtils.getProjectJavaVersion();
  if (version == null) {
    version=JavaUtils.DEFAULT_VERSION;
    JavaUtils.updateProjectJavaVersion(version);
  }
  Composite parent=getFieldEditorParent();
  parent.setLayout(new GridLayout(2,true));
  Label label=new Label(parent,SWT.NONE);
  label.setText(Messages.getString("String_Node_Str"));
  GridData labelData=new GridData(GridData.BEGINNING,GridData.CENTER,true,false,1,1);
  label.setLayoutData(labelData);
  combo=new Combo(parent,SWT.READ_ONLY);
  GridData comboData=new GridData(GridData.HORIZONTAL_ALIGN_END);
  comboData.widthHint=30;
  combo.setLayoutData(comboData);
  combo.setItems(JavaUtils.AVAILABLE_VERSIONS.toArray(new String[]{}));
  combo.select(JavaUtils.AVAILABLE_VERSIONS.indexOf(version));
}

Fixed version (ground truth):
@Override protected void createFieldEditors(){
  version=JavaUtils.getProjectJavaVersion();
  if (version == null) {
    version=JavaUtils.DEFAULT_VERSION;
    JavaUtils.updateProjectJavaVersion(version);
  }
  Composite parent=getFieldEditorParent();
  parent.setLayout(new GridLayout(2,true));
  Label label=new Label(parent,SWT.NONE);
  label.setText(Messages.getString("String_Node_Str"));
  GridData labelData=new GridData(GridData.BEGINNING,GridData.CENTER,false,false,1,1);
  label.setLayoutData(labelData);
  combo=new Combo(parent,SWT.READ_ONLY);
  GridData comboData=new GridData(GridData.BEGINNING,GridData.CENTER,false,false,1,1);
  GC gc=new GC(combo);
  Point labelSize=gc.stringExtent(JavaUtils.DEFAULT_VERSION);
  gc.dispose();
  int hint=labelSize.x + (ITabbedPropertyConstants.HSPACE * 14);
  comboData.widthHint=hint;
  combo.setLayoutData(comboData);
  combo.setItems(JavaUtils.AVAILABLE_VERSIONS.toArray(new String[]{}));
  combo.select(JavaUtils.AVAILABLE_VERSIONS.indexOf(version));
}
Program: 117963
Project: 117963
Buggy source:
public Date getOrder(){
  GregorianCalendar gc=new GregorianCalendar(2017,1,3,16,49,0);
  return gc.getTime();
}

Fixed version (ground truth):
@Override public Date getOrder(){
  GregorianCalendar gc=new GregorianCalendar(2017,1,3,16,49,0);
  return gc.getTime();
}
Program: 117964
Project: 117964
Buggy source:
public ExecutionResult execute(Item item){
  ProcessType processType=getProcessType(item);
  if (processType == null) {
    return ExecutionResult.NOTHING_TO_DO;
  }
  ProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  try {
    EList listParamType=processType.getParameters().getElementParameter();
    for (int j=0; j < listParamType.size(); j++) {
      ElementParameterType pType=(ElementParameterType)listParamType.get(j);
      if (pType.getName().equals("String_Node_Str")) {
        String value=pType.getValue().trim();
        if (value != null && value.length() > 0 && !isJson(value)) {
          try {
            JSONObject root=new JSONObject();
            JSONArray args=new JSONArray();
            String[] vms=value.split("String_Node_Str");
            for (int i=0; i < vms.length; i++) {
              args.put(vms[i]);
            }
            root.put("String_Node_Str",args);
            pType.setValue(root.toString());
            factory.save(item,true);
            break;
          }
 catch (          JSONException e) {
            ExceptionHandler.process(e);
            return ExecutionResult.FAILURE;
          }
        }
      }
    }
    return ExecutionResult.SUCCESS_WITH_ALERT;
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    return ExecutionResult.FAILURE;
  }
}

Fixed version (ground truth):
@Override public ExecutionResult execute(Item item){
  ProcessType processType=getProcessType(item);
  if (processType == null) {
    return ExecutionResult.NOTHING_TO_DO;
  }
  ParametersType parameters=processType.getParameters();
  if (parameters == null) {
    return ExecutionResult.NOTHING_TO_DO;
  }
  ProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  try {
    EList listParamType=parameters.getElementParameter();
    for (int j=0; j < listParamType.size(); j++) {
      ElementParameterType pType=(ElementParameterType)listParamType.get(j);
      if (pType.getName().equals("String_Node_Str")) {
        String value=pType.getValue().trim();
        if (value != null && value.length() > 0 && !isJson(value)) {
          try {
            JSONObject root=new JSONObject();
            JSONArray args=new JSONArray();
            String[] vms=value.split("String_Node_Str");
            for (            String vm : vms) {
              args.put(vm);
            }
            root.put("String_Node_Str",args);
            pType.setValue(root.toString());
            factory.save(item,true);
            break;
          }
 catch (          JSONException e) {
            ExceptionHandler.process(e);
            return ExecutionResult.FAILURE;
          }
        }
      }
    }
    return ExecutionResult.SUCCESS_WITH_ALERT;
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
    return ExecutionResult.FAILURE;
  }
}
Program: 117966
Project: 117966
Buggy source:
@Override public String getPartName(){
  if (item != null) {
    IRepositoryView viewPart=RepositoryManagerHelper.findRepositoryView();
    if (viewPart != null) {
      RepositoryNode repositoryNode=rEditorInput.getRepositoryNode();
      if (repositoryNode != null) {
        return getTitleText(repositoryNode.getObject());
      }
    }
  }
  return super.getPartName();
}

Fixed version (ground truth):
@Override public String getPartName(){
  String title=null;
  if (item != null) {
    IRepositoryView viewPart=RepositoryManagerHelper.findRepositoryView();
    if (viewPart != null) {
      RepositoryNode repositoryNode=rEditorInput.getRepositoryNode();
      if (repositoryNode != null) {
        return getTitleText(repositoryNode.getObject());
      }
 else {
        title=super.getPartName() + "String_Node_Str" + rEditorInput.getItem().getProperty().getVersion();
      }
    }
  }
  return title;
}
Program: 117967
Project: 117967
Buggy source:
@Override public String getProcessName(){
  return getProcess().getLabel();
}

Fixed version (ground truth):
@Override public String getProcessName(){
  return name;
}
Program: 117968
Project: 117968
Buggy source:
@Override public void performancesChanged(String connId,int exchangesCompleted){
  long duration=100;
  final IConnection conn=traceConnectionsManager.finConnectionByUniqueName(connId);
  final PerformanceData perfData=new PerformanceData(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration);
  processPerformances(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration,perfData,conn);
  startTime=System.currentTimeMillis();
}

Fixed version (ground truth):
@Override public void performancesChanged(String connId,int exchangesCompleted){
  long duration=System.currentTimeMillis() - startTime;
  final IConnection conn=traceConnectionsManager.finConnectionByUniqueName(connId);
  final PerformanceData perfData=new PerformanceData(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration);
  processPerformances(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration,perfData,conn);
  startTime=System.currentTimeMillis();
}
Program: 117969
Project: 117969
Buggy source:
public JMXPerformanceMonitor(){
  jmxManager=JMXRunStatManager.getInstance();
  jmxPerformanceChangeListener=new JMXPerformanceChangeListener(){
    long startTime=System.currentTimeMillis();
    @Override public String getProcessName(){
      return getProcess().getLabel();
    }
    @Override public void performancesChanged(    String connId,    int exchangesCompleted){
      long duration=100;
      final IConnection conn=traceConnectionsManager.finConnectionByUniqueName(connId);
      final PerformanceData perfData=new PerformanceData(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration);
      processPerformances(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration,perfData,conn);
      startTime=System.currentTimeMillis();
    }
  }
;
}

Fixed version (ground truth):
public JMXPerformanceMonitor(){
  jmxManager=JMXRunStatManager.getInstance();
  jmxPerformanceChangeListener=new JMXPerformanceChangeListener(){
    long startTime=System.currentTimeMillis();
    String name=process.getLabel();
    @Override public String getProcessName(){
      return name;
    }
    @Override public void performancesChanged(    String connId,    int exchangesCompleted){
      long duration=System.currentTimeMillis() - startTime;
      final IConnection conn=traceConnectionsManager.finConnectionByUniqueName(connId);
      final PerformanceData perfData=new PerformanceData(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration);
      processPerformances(connId + "String_Node_Str" + exchangesCompleted+ "String_Node_Str"+ duration,perfData,conn);
      startTime=System.currentTimeMillis();
    }
  }
;
}
Program: 117970
Project: 117970
Buggy source:
@Override public void run(){
  stopTracing=false;
  while (server != null && !stopTracing) {
    if (listeners.size() > 0) {
      try {
        Set<ObjectName> components=server.queryNames(new ObjectName("String_Node_Str" + projectLabel + "String_Node_Str"),null);
        for (        ObjectName component : components) {
          int completed=Integer.parseInt(String.valueOf(server.getAttribute(component,"String_Node_Str")));
          String camelID=String.valueOf(server.getAttribute(component,"String_Node_Str"));
          String processorId=String.valueOf(server.getAttribute(component,"String_Node_Str"));
          for (          JMXPerformanceChangeListener listener : listeners) {
            if (listener.getProcessName().equals(camelID.substring(camelID.lastIndexOf('.') + 1))) {
              listener.performancesChanged(targetNodeToConnectionMap.get(processorId),completed);
            }
          }
        }
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
    }
    try {
      TimeUnit.MILLISECONDS.sleep(100);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
  ;
}

Fixed version (ground truth):
@Override public void run(){
  stopTracing=false;
  Map<String,Integer> completedHistory=new HashMap();
  while (server != null && !stopTracing) {
    if (listeners.size() > 0) {
      try {
        Set<ObjectName> components=server.queryNames(new ObjectName("String_Node_Str" + projectLabel + "String_Node_Str"),null);
        for (        ObjectName component : components) {
          int completed=Integer.parseInt(String.valueOf(server.getAttribute(component,"String_Node_Str")));
          String camelID=String.valueOf(server.getAttribute(component,"String_Node_Str"));
          String processorId=String.valueOf(server.getAttribute(component,"String_Node_Str"));
          for (          JMXPerformanceChangeListener listener : listeners) {
            if (listener.getProcessName().equals(camelID.substring(camelID.lastIndexOf('.') + 1))) {
              if (completedHistory.get(processorId) != null && completed == completedHistory.get(processorId)) {
                continue;
              }
 else {
                completedHistory.put(processorId,completed);
                listener.performancesChanged(targetNodeToConnectionMap.get(processorId),completed);
              }
            }
          }
        }
        TimeUnit.MILLISECONDS.sleep(100);
      }
 catch (      Exception e1) {
        e1.printStackTrace();
      }
    }
  }
  ;
}
Program: 117975
Project: 117975
Buggy source:
public static Object getParameterValue(IElement element,Property property,EParameterFieldType fieldType,boolean isInitializing){
  Object paramValue=property.getStoredValue();
  if (paramValue instanceof List) {
    return null;
  }
  if (fieldType == EParameterFieldType.CLOSED_LIST) {
    if (paramValue == null) {
      List<?> possibleValues=property.getPossibleValues();
      if (possibleValues != null && possibleValues.size() > 0) {
        paramValue=possibleValues.get(0);
        property.setValue(paramValue);
      }
    }
  }
 else   if (GenericTypeUtils.isStringType(property)) {
    String value=(String)paramValue;
    if ((isInitializing || StringUtils.isEmpty(value)) && !(element instanceof FakeElement || ContextParameterUtils.isContainContextParam(value))) {
      if (value == null) {
        value=StringUtils.EMPTY;
      }
      paramValue=TalendQuoteUtils.addPairQuotesIfNotExist(unescapeForJava(value));
      property.setValue(paramValue);
    }
  }
 else   if (GenericTypeUtils.isBooleanType(property)) {
    if (paramValue == null) {
      paramValue=Boolean.FALSE;
      property.setValue(paramValue);
    }
  }
  return paramValue;
}

Fixed version (ground truth):
public static Object getParameterValue(IElement element,Property property,EParameterFieldType fieldType){
  Object paramValue=property.getStoredValue();
  if (paramValue instanceof List) {
    return null;
  }
  if (fieldType == EParameterFieldType.CLOSED_LIST) {
    if (paramValue == null) {
      List<?> possibleValues=property.getPossibleValues();
      if (possibleValues != null && possibleValues.size() > 0) {
        paramValue=possibleValues.get(0);
        property.setValue(paramValue);
      }
    }
  }
 else   if (GenericTypeUtils.isStringType(property)) {
    String value=(String)paramValue;
    if (!(element instanceof FakeElement || ContextParameterUtils.isContainContextParam(value) || isPropertyChangedByUser(property))) {
      if (value == null) {
        value=StringUtils.EMPTY;
      }
      paramValue=TalendQuoteUtils.addPairQuotesIfNotExist(unescapeForJava(value));
      property.setValue(paramValue);
    }
  }
 else   if (GenericTypeUtils.isBooleanType(property)) {
    if (paramValue == null) {
      paramValue=Boolean.FALSE;
      property.setValue(paramValue);
    }
  }
  return paramValue;
}
Program: 117977
Project: 117977
Buggy source:
@Override protected Object openDialogBox(Control cellEditorWindow){
  ITDQPatternService service=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQPatternService.class)) {
    service=(ITDQPatternService)GlobalServiceRegister.getDefault().getService(ITDQPatternService.class);
  }
  if (service != null) {
    IElementParameter typeParam=node.getElementParameter("String_Node_Str");
    if (typeParam == null && node.getIncomingConnections().size() > 0) {
      IConnection iConnection=node.getIncomingConnections().get(0);
      typeParam=iConnection.getElementParameter("String_Node_Str");
    }
    String[] patternInfo=service.selectPattern(cellEditorWindow.getShell(),typeParam);
    if (patternInfo != null) {
      int index=0;
      TableViewer tableViewer=getTableViewer();
      if (tableViewer != null) {
        index=getTableViewer().getTable().getSelectionIndex();
      }
      updatePatterInfoOnRow(index,patternInfo);
      IElementParameter property=node.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
      if (property != null) {
        property.setValue(EmfComponent.REPOSITORY);
        IElementParameter repositoryParam=node.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
        if (repositoryParam != null) {
          repositoryParam.setValue(patternInfo[0]);
        }
      }
    }
    return patternInfo[1];
  }
  return null;
}

Fixed version (ground truth):
@Override protected Object openDialogBox(Control cellEditorWindow){
  ITDQPatternService service=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQPatternService.class)) {
    service=(ITDQPatternService)GlobalServiceRegister.getDefault().getService(ITDQPatternService.class);
  }
  if (service != null) {
    IElementParameter typeParam=node.getElementParameter("String_Node_Str");
    if (typeParam == null && node.getIncomingConnections().size() > 0) {
      IConnection iConnection=node.getIncomingConnections().get(0);
      typeParam=iConnection.getElementParameter("String_Node_Str");
    }
    String[] patternInfo=service.selectPattern(cellEditorWindow.getShell(),typeParam);
    if (patternInfo != null) {
      int index=0;
      TableViewer tableViewer=getTableViewer();
      if (tableViewer != null) {
        index=tableViewer.getTable().getSelectionIndex();
      }
      updatePatterInfoOnRow(index,patternInfo);
      IElementParameter property=node.getElementParameter(EParameterName.PROPERTY_TYPE.getName());
      if (property != null) {
        IElementParameter repositoryParam=node.getElementParameter(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
        if (StringUtils.isNotBlank(patternInfo[0])) {
          property.setValue(EmfComponent.REPOSITORY);
          if (repositoryParam != null) {
            repositoryParam.setValue(patternInfo[0]);
          }
        }
      }
    }
    return patternInfo[1];
  }
  return null;
}
Program: 117982
Project: 117982
Buggy source:
@After public void clean(){
  if (workFolder != null) {
    FilesUtils.deleteFolder(workFolder,true);
  }
  CodeGeneratorActivator.getDefault().getPreferenceStore().setValue(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS,new JSONObject().toString());
}

Fixed version (ground truth):
@After public void clean(){
  if (workFolder != null) {
    FilesUtils.deleteFolder(workFolder,true);
  }
  CodeGeneratorActivator.getDefault().getPreferenceStore().setValue(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS,new JSONArray().toString());
}
Program: 117983
Project: 117983
Buggy source:
private void testEmpty(UserComponentsProviderTestClass provider) throws Exception {
  File installationFolder=provider.getInstallationFolder();
  Assert.assertTrue(installationFolder.exists());
  Assert.assertEquals(0,installationFolder.list().length);
  String installedComponentsValues=CodeGeneratorActivator.getDefault().getPreferenceStore().getString(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS);
  JSONObject newCFComponentsJson=new JSONObject();
  if (StringUtils.isNotEmpty(installedComponentsValues)) {
    newCFComponentsJson=new JSONObject(installedComponentsValues);
  }
  Assert.assertEquals(0,newCFComponentsJson.length());
}

Fixed version (ground truth):
private void testEmpty(UserComponentsProviderTestClass provider) throws Exception {
  File installationFolder=provider.getInstallationFolder();
  Assert.assertTrue(installationFolder.exists());
  Assert.assertEquals(0,installationFolder.list().length);
  String installedComponentsValues=CodeGeneratorActivator.getDefault().getPreferenceStore().getString(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS);
  JSONArray newCFComponentsJson=new JSONArray();
  if (StringUtils.isNotEmpty(installedComponentsValues)) {
    newCFComponentsJson=new JSONArray(installedComponentsValues);
  }
  Assert.assertEquals(0,newCFComponentsJson.length());
  final JSONObject needInstalledNewCFComponents=provider.getNeedInstalledNewCFComponents();
  Assert.assertNotNull(needInstalledNewCFComponents);
  Assert.assertEquals(0,needInstalledNewCFComponents.length());
}
Program: 117984
Project: 117984
Buggy source:
@Before public void setup() throws Exception {
  workFolder=FileUtils.createTmpFolder("String_Node_Str","String_Node_Str");
  CodeGeneratorActivator.getDefault().getPreferenceStore().setValue(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS,new JSONObject().toString());
  final Project currentProject=ProjectManager.getInstance().getCurrentProject();
  final IProject project=ResourceUtils.getProject(currentProject);
  final IFolder projectComponentsFolder=project.getFolder(ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS));
  if (projectComponentsFolder.exists()) {
    FilesUtils.deleteFolder(projectComponentsFolder.getLocation().toFile(),false);
  }
  projectComponentsFolder.refreshLocal(IResource.DEPTH_INFINITE,null);
}

Fixed version (ground truth):
@Before public void setup() throws Exception {
  workFolder=FileUtils.createTmpFolder("String_Node_Str","String_Node_Str");
  CodeGeneratorActivator.getDefault().getPreferenceStore().setValue(IComponentPreferenceConstant.INSTALLED_USER_COMPONENTS,new JSONArray().toString());
  final Project currentProject=ProjectManager.getInstance().getCurrentProject();
  final IProject project=ResourceUtils.getProject(currentProject);
  final IFolder projectComponentsFolder=project.getFolder(ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS));
  if (projectComponentsFolder.exists()) {
    FilesUtils.deleteFolder(projectComponentsFolder.getLocation().toFile(),false);
  }
  projectComponentsFolder.refreshLocal(IResource.DEPTH_INFINITE,null);
}
Program: 117985
Project: 117985
Buggy source:
public static IBuildJobHandler createBuildJobHandler(ProcessItem processItem,String contextName,String version,Map<ExportChoice,Object> exportChoiceMap){
  return createBuildJobHandler(processItem,version,contextName,exportChoiceMap,(String)null);
}

Fixed version (ground truth):
public static IBuildJobHandler createBuildJobHandler(ProcessItem processItem,String contextName,String version,Map<ExportChoice,Object> exportChoiceMap){
  return createBuildJobHandler(processItem,contextName,version,exportChoiceMap,(String)null);
}
Program: 117987
Project: 117987
Buggy source:
@Test public void testLoadComponents(){
  ComponentService componentService=ComponentsUtils.getComponentService();
  Set<ComponentDefinition> componentDefinitions=componentService.getAllComponents();
  Set<IComponent> coms=ComponentsFactoryProvider.getInstance().getComponents();
  List<IComponent> comList=new ArrayList<IComponent>();
  for (  ComponentDefinition componentDefinition : componentDefinitions) {
    for (    IComponent com : coms) {
      if (com.getName().equals(componentDefinition.getName())) {
        comList.add(com);
        break;
      }
    }
  }
  coms.removeAll(comList);
  ComponentsUtils.loadComponents(componentService);
  coms=ComponentsFactoryProvider.getInstance().getComponents();
  for (  ComponentDefinition componentDefinition : componentDefinitions) {
    if (componentDefinition.getName().equals("String_Node_Str")) {
      continue;
    }
    for (    IComponent com : coms) {
      if (com.getName().equals(componentDefinition.getName())) {
        assertFalse("String_Node_Str" + componentDefinition.getName(),true);
      }
    }
  }
}

Fixed version (ground truth):
@Test public void testLoadComponents(){
  ComponentService componentService=ComponentsUtils.getComponentService();
  Set<ComponentDefinition> componentDefinitions=componentService.getAllComponents();
  Set<IComponent> coms=ComponentsFactoryProvider.getInstance().getComponents();
  List<IComponent> comList=new ArrayList<IComponent>();
  for (  ComponentDefinition componentDefinition : componentDefinitions) {
    for (    IComponent com : coms) {
      if (com.getName().equals(componentDefinition.getName())) {
        comList.add(com);
        break;
      }
    }
  }
  coms.removeAll(comList);
  ComponentsUtils.loadComponents(componentService);
  coms=ComponentsFactoryProvider.getInstance().getComponents();
  for (  ComponentDefinition componentDefinition : componentDefinitions) {
    if (!componentDefinition.getName().equals("String_Node_Str")) {
      continue;
    }
    for (    IComponent com : coms) {
      if (com.getName().equals(componentDefinition.getName())) {
        assertFalse("String_Node_Str" + componentDefinition.getName(),true);
      }
    }
  }
}
Program: 117988
Project: 117988
Buggy source:
@Override public boolean isAvailable(String componentName){
  if (Boolean.getBoolean("String_Node_Str")) {
    if (!componentName.equals("String_Node_Str")) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean isAvailable(String componentName){
  if (Boolean.getBoolean("String_Node_Str")) {
    if (componentName.equals("String_Node_Str")) {
      return false;
    }
  }
  return true;
}