nus-yam/ex-repair huggingface dataset:
Program: 140714
Project: 140714
Buggy source:
public String getText(Object element){
  if (element instanceof TableFolderNode) {
    TableFolderNode node=(TableFolderNode)element;
    if (node.isLoaded()) {
      Package catalogOrSchema=PackageHelper.getCatalogOrSchema(node.getParent());
      return ((IFolderNode)element).getName() + "String_Node_Str" + PackageHelper.getTables(catalogOrSchema).size()+ "String_Node_Str";
    }
 else {
      return ((IFolderNode)element).getName();
    }
  }
  if (element instanceof ViewFolderNode) {
    ViewFolderNode node=(ViewFolderNode)element;
    if (node.isLoaded()) {
      Package catalogOrSchema=PackageHelper.getCatalogOrSchema(node.getParent());
      return ((IFolderNode)element).getName() + "String_Node_Str" + PackageHelper.getViews(catalogOrSchema).size()+ "String_Node_Str";
    }
 else {
      return ((IFolderNode)element).getName();
    }
  }
  if (element instanceof ColumnFolderNode) {
    ColumnFolderNode node=(ColumnFolderNode)element;
    if (node.isLoaded()) {
      ColumnSet table=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(node.getParent());
      return ((IFolderNode)element).getName() + "String_Node_Str" + ColumnSetHelper.getColumns(table).size()+ "String_Node_Str";
    }
 else {
      return ((IFolderNode)element).getName();
    }
  }
  if (element instanceof Pattern) {
    Pattern pattern=(Pattern)element;
    RegularExpression patternComponent=(RegularExpression)pattern.getComponents().get(0);
    return patternComponent.getExpression().getBody();
  }
  return super.getText(element);
}

Fixed version (ground truth):
public String getText(Object element){
  if (element instanceof TableFolderNode) {
    TableFolderNode node=(TableFolderNode)element;
    Package catalogOrSchema=PackageHelper.getCatalogOrSchema(node.getParent());
    return ((IFolderNode)element).getName() + "String_Node_Str" + PackageHelper.getTables(catalogOrSchema).size()+ "String_Node_Str";
  }
  if (element instanceof ViewFolderNode) {
    ViewFolderNode node=(ViewFolderNode)element;
    Package catalogOrSchema=PackageHelper.getCatalogOrSchema(node.getParent());
    return ((IFolderNode)element).getName() + "String_Node_Str" + PackageHelper.getViews(catalogOrSchema).size()+ "String_Node_Str";
  }
  if (element instanceof ColumnFolderNode) {
    ColumnFolderNode node=(ColumnFolderNode)element;
    ColumnSet table=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch(node.getParent());
    return ((IFolderNode)element).getName() + "String_Node_Str" + ColumnSetHelper.getColumns(table).size()+ "String_Node_Str";
  }
  if (element instanceof Pattern) {
    Pattern pattern=(Pattern)element;
    RegularExpression patternComponent=(RegularExpression)pattern.getComponents().get(0);
    return patternComponent.getExpression().getBody();
  }
  return super.getText(element);
}
Program: 140715
Project: 140715
Buggy source:
@SuppressWarnings("String_Node_Str") public Object[] getChildren(Object parentElement){
  if (parentElement instanceof IContainer) {
    IContainer container=((IContainer)parentElement);
    IResource[] members=null;
    try {
      members=container.members();
    }
 catch (    CoreException e) {
      log.error("String_Node_Str" + container.getLocation());
    }
    if (container.equals(ResourcesPlugin.getWorkspace().getRoot().getProject(DQStructureManager.METADATA).getFolder(DQStructureManager.DB_CONNECTIONS))) {
      sort(members,ComparatorsFactory.FILEMODEL_COMPARATOR_ID);
    }
    return members;
  }
 else   if (parentElement instanceof NamedColumnSet) {
    return null;
  }
 else   if (parentElement instanceof NamedColumnSetFolderNode) {
    NamedColumnSetFolderNode folerNode=(NamedColumnSetFolderNode)parentElement;
    if (!(folerNode.isLoaded())) {
      folerNode.loadChildren();
    }
    Object[] children=folerNode.getChildren();
    if (children != null && children.length > 0) {
      if (!(children[0] instanceof ColumnSet)) {
        return children;
      }
      for (int i=0; i < children.length; i++) {
        ColumnSet columnSet=(ColumnSet)children[i];
        ColumnSetKey key=new ColumnSetKey(columnSet);
        if (columnSetCheckedMap.containsKey(key)) {
          currentCheckedColumnSet.add(columnSet);
        }
      }
    }
    return sort(children,ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
  }
  return super.getChildren(parentElement);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object[] getChildren(Object parentElement){
  if (parentElement instanceof IContainer) {
    IContainer container=((IContainer)parentElement);
    IResource[] members=null;
    try {
      members=container.members();
    }
 catch (    CoreException e) {
      log.error("String_Node_Str" + container.getLocation());
    }
    if (container.equals(ResourcesPlugin.getWorkspace().getRoot().getProject(DQStructureManager.METADATA).getFolder(DQStructureManager.DB_CONNECTIONS))) {
      ComparatorsFactory.sort(members,ComparatorsFactory.FILEMODEL_COMPARATOR_ID);
    }
    return members;
  }
 else   if (parentElement instanceof NamedColumnSet) {
    return null;
  }
 else   if (parentElement instanceof NamedColumnSetFolderNode) {
    NamedColumnSetFolderNode folerNode=(NamedColumnSetFolderNode)parentElement;
    if (!(folerNode.isLoaded())) {
      folerNode.loadChildren();
    }
    Object[] children=folerNode.getChildren();
    if (children != null && children.length > 0) {
      if (!(children[0] instanceof ColumnSet)) {
        return children;
      }
      for (int i=0; i < children.length; i++) {
        ColumnSet columnSet=(ColumnSet)children[i];
        ColumnSetKey key=new ColumnSetKey(columnSet);
        if (columnSetCheckedMap.containsKey(key)) {
          currentCheckedColumnSet.add(columnSet);
        }
      }
    }
    return ComparatorsFactory.sort(children,ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
  }
  return super.getChildren(parentElement);
}
Program: 140716
Project: 140716
Buggy source:
private static CategoryDataset createTextedDataset(List<IndicatorUnit> indicatorUnitList,boolean isCreate){
  return createSimpleDataset(indicatorUnitList,isCreate);
}

Fixed version (ground truth):
private static CategoryDataset createTextedDataset(List<IndicatorUnit> indicatorUnitList,boolean isCreate){
  ComparatorsFactory.sort(indicatorUnitList,ComparatorsFactory.TEXT_STATISTICS_COMPARATOR_ID);
  return createSimpleDataset(indicatorUnitList,isCreate);
}
Program: 140717
Project: 140717
Buggy source:
public int compare(Object arg0,Object arg1){
  if (arg0 == null || arg1 == null) {
    return 0;
  }
  String name0=((ModelElement)arg0).getName();
  String name1=((ModelElement)arg1).getName();
  if (name0 == null || name1 == null) {
    return 0;
  }
  return name0.compareTo(name1);
}

Fixed version (ground truth):
@Override public int compare(IndicatorUnit o1,IndicatorUnit o2){
  IndicatorCommonUtil.compositeIndicatorMap(o1);
  IndicatorCommonUtil.compositeIndicatorMap(o2);
  double value1=Double.parseDouble(String.valueOf(o1.getValue()));
  double value2=Double.parseDouble(String.valueOf(o2.getValue()));
  if (value1 <= value2) {
    return -1;
  }
 else {
    return 1;
  }
}
Program: 140718
Project: 140718
Buggy source:
@SuppressWarnings("String_Node_Str") public static Comparator buildComparator(int comparatorId){
switch (comparatorId) {
case FILEMODEL_COMPARATOR_ID:
    return new FileModelComparator();
case MODELELEMENT_COMPARATOR_ID:
  return new ModelElementComparator();
default :
return new ModelElementComparator();
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static Comparator buildComparator(int comparatorId){
switch (comparatorId) {
case FILEMODEL_COMPARATOR_ID:
    return new FileModelComparator();
case MODELELEMENT_COMPARATOR_ID:
  return new ModelElementComparator();
case TEXT_STATISTICS_COMPARATOR_ID:
return new TextStatisticsComparator();
default :
return new ModelElementComparator();
}
}
Program: 140719
Project: 140719
Buggy source:
public Object[] getChildren(Object parentElement){
  if (parentElement instanceof IFile) {
    IFile file=(IFile)parentElement;
    if (file.getName().endsWith(PluginConstant.REP_SUFFIX)) {
      TdReport findReport=RepResourceFileHelper.getInstance().findReport(file);
      Object[] array=ReportHelper.getAnalyses(findReport).toArray();
      return sort(array,ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
    }
    parentElement=PrvResourceFileHelper.getInstance().getFileResource(file);
  }
 else   if (parentElement instanceof IFolderNode) {
    IFolderNode folerNode=(IFolderNode)parentElement;
    if (!(folerNode.isLoaded())) {
      folerNode.loadChildren();
    }
    return sort(folerNode.getChildren(),ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
  }
 else   if (SwitchHelpers.CATALOG_SWITCH.doSwitch((EObject)parentElement) != null) {
    if (CatalogHelper.getSchemas(SwitchHelpers.CATALOG_SWITCH.doSwitch((EObject)parentElement)).size() > 0) {
      return sort(super.getChildren(parentElement),ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
    }
 else {
      return FolderNodeHelper.getFolderNode((EObject)parentElement);
    }
  }
 else {
    return FolderNodeHelper.getFolderNode((EObject)parentElement);
  }
  return sort(super.getChildren(parentElement),ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
}

Fixed version (ground truth):
public Object[] getChildren(Object parentElement){
  if (parentElement instanceof IFile) {
    IFile file=(IFile)parentElement;
    if (file.getName().endsWith(PluginConstant.REP_SUFFIX)) {
      TdReport findReport=RepResourceFileHelper.getInstance().findReport(file);
      Object[] array=ReportHelper.getAnalyses(findReport).toArray();
      return ComparatorsFactory.sort(array,ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
    }
    parentElement=PrvResourceFileHelper.getInstance().getFileResource(file);
  }
 else   if (parentElement instanceof IFolderNode) {
    IFolderNode folerNode=(IFolderNode)parentElement;
    if (!(folerNode.isLoaded())) {
      folerNode.loadChildren();
    }
    return ComparatorsFactory.sort(folerNode.getChildren(),ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
  }
 else   if (SwitchHelpers.CATALOG_SWITCH.doSwitch((EObject)parentElement) != null) {
    if (CatalogHelper.getSchemas(SwitchHelpers.CATALOG_SWITCH.doSwitch((EObject)parentElement)).size() > 0) {
      return ComparatorsFactory.sort(super.getChildren(parentElement),ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
    }
 else {
      return FolderNodeHelper.getFolderNode((EObject)parentElement);
    }
  }
 else {
    return FolderNodeHelper.getFolderNode((EObject)parentElement);
  }
  return ComparatorsFactory.sort(super.getChildren(parentElement),ComparatorsFactory.MODELELEMENT_COMPARATOR_ID);
}
Program: 140721
Project: 140721
Buggy source:
/** 
 * qzhang FolderSelectionDialog constructor comment.
 * @param parent
 * @param labelProvider
 * @param contentProvider
 */
public FolderSelectionDialog(Shell parent,ILabelProvider labelProvider,ITreeContentProvider contentProvider){
  super(parent,labelProvider,contentProvider);
  setComparator(new ResourceComparator(ResourceComparator.NAME));
}

Fixed version (ground truth):
/** 
 * qzhang FolderSelectionDialog constructor comment.
 * @param parent
 * @param labelProvider
 * @param contentProvider
 */
public FolderSelectionDialog(Shell parent,ILabelProvider labelProvider,ITreeContentProvider contentProvider){
  super(parent,labelProvider,contentProvider);
  setComparator(new ResourceComparator(ResourceComparator.NAME));
  setValidator(new ISelectionStatusValidator(){
    public IStatus validate(    Object[] selection){
      if (selection.length == 1) {
        if (selection[0] instanceof IFolder) {
          IFolder folder=(IFolder)selection[0];
          IPath projectRelativePath=folder.getProjectRelativePath();
          if ("String_Node_Str".equals(folder.getProject().getName())) {
            IPath path=new Path("String_Node_Str");
            if (path.isPrefixOf(projectRelativePath)) {
              return Status.OK_STATUS;
            }
          }
        }
      }
      return new Status(IStatus.ERROR,SQLExplorerPlugin.PLUGIN_ID,"String_Node_Str");
    }
  }
);
}
Program: 140722
Project: 140722
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (IProject.class.isInstance(element)) {
    return "String_Node_Str".equals(((IProject)element).getName());
  }
 else   if (IFolder.class.isInstance(element)) {
    return "String_Node_Str".equals(((IFolder)element).getName());
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (IProject.class.isInstance(element)) {
    return "String_Node_Str".equals(((IProject)element).getName());
  }
 else   if (IFolder.class.isInstance(element)) {
    IPath path=new Path("String_Node_Str");
    IPath projectRelativePath=((IFolder)element).getProjectRelativePath();
    return path.isPrefixOf(projectRelativePath);
  }
  return false;
}
Program: 140724
Project: 140724
Buggy source:
public ColumnsSelectionDialog(Shell parent,ColumnIndicator[] columnIndicators,String message){
  super(parent,message);
  addFirstPartFilters();
  this.setInput(ResourcesPlugin.getWorkspace().getRoot());
  columnSetCheckedMap=new HashMap<ColumnSetKey,ColumnCheckedMap>();
  initCheckedColumn(columnIndicators);
}

Fixed version (ground truth):
public ColumnsSelectionDialog(Shell parent,String title,ColumnIndicator[] columnIndicators,String message){
  super(parent,message);
  addFirstPartFilters();
  this.setInput(ResourcesPlugin.getWorkspace().getRoot());
  columnSetCheckedMap=new HashMap<ColumnSetKey,ColumnCheckedMap>();
  initCheckedColumn(columnIndicators);
  this.setTitle(title);
}
Program: 140725
Project: 140725
Buggy source:
/** 
 * @param parentShell
 */
public IndicatorSelectDialog(Shell parentShell,String title,ColumnIndicator[] columnIndicators){
  super(parentShell);
  this.columnIndicators=columnIndicators;
  this.setShellStyle(SWT.MAX | SWT.RESIZE);
}

Fixed version (ground truth):
/** 
 * @param parentShell
 */
public IndicatorSelectDialog(Shell parentShell,String title,ColumnIndicator[] columnIndicators){
  super(parentShell);
  this.title=title;
  this.columnIndicators=columnIndicators;
  this.setShellStyle(SWT.MAX | SWT.RESIZE);
}
Program: 140726
Project: 140726
Buggy source:
void createAnalysisColumnsSection(final ScrolledForm form,Composite anasisDataComp){
  Section section=createSection(form,anasisDataComp,"String_Node_Str",false,null);
  Composite topComp=toolkit.createComposite(section);
  topComp.setLayout(new GridLayout());
  Hyperlink clmnBtn=toolkit.createHyperlink(topComp,"String_Node_Str",SWT.NONE);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.TOP).applyTo(clmnBtn);
  clmnBtn.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      openColumnsSelectionDialog();
    }
  }
);
  Hyperlink indcBtn=toolkit.createHyperlink(topComp,"String_Node_Str",SWT.NONE);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.TOP).applyTo(indcBtn);
  indcBtn.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      treeViewer.openIndicatorSelectDialog(getSite().getShell());
    }
  }
);
  Composite tree=toolkit.createComposite(topComp,SWT.BORDER);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(tree);
  tree.setLayout(new GridLayout());
  ((GridData)tree.getLayoutData()).heightHint=TREE_MAX_LENGTH;
  treeViewer=new AnalysisColumnTreeViewer(tree,currentColumnIndicators,analysisHandler.getAnalysis());
  treeViewer.setDirty(false);
  treeViewer.addPropertyChangeListener(this);
  section.setClient(topComp);
}

Fixed version (ground truth):
void createAnalysisColumnsSection(final ScrolledForm form,Composite anasisDataComp){
  Section section=createSection(form,anasisDataComp,"String_Node_Str",false,null);
  Composite topComp=toolkit.createComposite(section);
  topComp.setLayout(new GridLayout());
  Hyperlink clmnBtn=toolkit.createHyperlink(topComp,"String_Node_Str",SWT.NONE);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.TOP).applyTo(clmnBtn);
  clmnBtn.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      openColumnsSelectionDialog();
    }
  }
);
  Hyperlink indcBtn=toolkit.createHyperlink(topComp,"String_Node_Str",SWT.NONE);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.TOP).applyTo(indcBtn);
  indcBtn.addHyperlinkListener(new HyperlinkAdapter(){
    public void linkActivated(    HyperlinkEvent e){
      treeViewer.openIndicatorSelectDialog(null);
    }
  }
);
  Composite tree=toolkit.createComposite(topComp,SWT.BORDER);
  GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(tree);
  tree.setLayout(new GridLayout());
  ((GridData)tree.getLayoutData()).heightHint=TREE_MAX_LENGTH;
  treeViewer=new AnalysisColumnTreeViewer(tree,currentColumnIndicators,analysisHandler.getAnalysis());
  treeViewer.setDirty(false);
  treeViewer.addPropertyChangeListener(this);
  section.setClient(topComp);
}
Program: 140727
Project: 140727
Buggy source:
/** 
 */
public void openColumnsSelectionDialog(){
  ColumnIndicator[] columnIndicator=treeViewer.getColumnIndicator();
  ColumnsSelectionDialog dialog=new ColumnsSelectionDialog(getSite().getShell(),columnIndicator,"String_Node_Str");
  if (dialog.open() == Window.OK) {
    Object[] columns=dialog.getResult();
    treeViewer.setInput(columns);
    return;
  }
}

Fixed version (ground truth):
/** 
 */
public void openColumnsSelectionDialog(){
  ColumnIndicator[] columnIndicator=treeViewer.getColumnIndicator();
  ColumnsSelectionDialog dialog=new ColumnsSelectionDialog(null,"String_Node_Str",columnIndicator,"String_Node_Str");
  if (dialog.open() == Window.OK) {
    Object[] columns=dialog.getResult();
    treeViewer.setInput(columns);
    return;
  }
}
Program: 140728
Project: 140728
Buggy source:
/** 
 * Create a new IndicatorUnit according to indicatorEnum and indicator, if the parameter indicator is null, will create a new indicator .
 * @param indicatorEnum
 * @param indicator
 * @return
 */
private IndicatorUnit createPlainIndicatorUnit(IndicatorEnum indicatorEnum,Indicator indicator){
  if (indicator == null) {
    IndicatorsFactory factory=IndicatorsFactory.eINSTANCE;
    indicator=(Indicator)factory.create(indicatorEnum.getIndicatorType());
    if (indicatorEnum == IndicatorEnum.FrequencyIndicatorEnum) {
      IndicatorParameters parameters=indicator.getParameters();
      if (parameters == null) {
        parameters=IndicatorsFactory.eINSTANCE.createIndicatorParameters();
        indicator.setParameters(parameters);
      }
      DateParameters dateParameters=parameters.getDateParameters();
      if (dateParameters == null) {
        dateParameters=IndicatorsFactory.eINSTANCE.createDateParameters();
        parameters.setDateParameters(dateParameters);
      }
    }
  }
  IndicatorUnit indicatorUnit=new IndicatorUnit(indicatorEnum,indicator,this);
  this.plainIndicatorUnitMap.put(indicatorEnum,indicatorUnit);
  return indicatorUnit;
}

Fixed version (ground truth):
/** 
 * Create a new IndicatorUnit according to indicatorEnum and indicator, if the parameter indicator is null, will create a new indicator .
 * @param indicatorEnum
 * @param indicator
 * @return
 */
private IndicatorUnit createPlainIndicatorUnit(IndicatorEnum indicatorEnum,Indicator indicator){
  if (indicator == null) {
    IndicatorsFactory factory=IndicatorsFactory.eINSTANCE;
    indicator=(Indicator)factory.create(indicatorEnum.getIndicatorType());
    int sqlType=this.tdColumn.getJavaType();
    if (indicatorEnum == IndicatorEnum.FrequencyIndicatorEnum && Java2SqlType.isDateInSQL(sqlType)) {
      IndicatorParameters parameters=indicator.getParameters();
      if (parameters == null) {
        parameters=IndicatorsFactory.eINSTANCE.createIndicatorParameters();
        indicator.setParameters(parameters);
      }
      DateParameters dateParameters=parameters.getDateParameters();
      if (dateParameters == null) {
        dateParameters=IndicatorsFactory.eINSTANCE.createDateParameters();
        parameters.setDateParameters(dateParameters);
      }
    }
  }
  IndicatorUnit indicatorUnit=new IndicatorUnit(indicatorEnum,indicator,this);
  this.plainIndicatorUnitMap.put(indicatorEnum,indicatorUnit);
  return indicatorUnit;
}
Program: 140729
Project: 140729
Buggy source:
private void removeDependencys(IResource[] resources){
  for (  IResource selectedObj : resources) {
    IFile file=((IFile)selectedObj);
    ModelElement elementToDelete=null;
    if (file.getFileExtension().equalsIgnoreCase(FactoriesUtil.PROV)) {
      TypedReturnCode<TdDataProvider> returnValue=PrvResourceFileHelper.getInstance().readFromFile(file);
      elementToDelete=returnValue.getObject();
    }
 else     if (file.getFileExtension().equalsIgnoreCase(FactoriesUtil.ANA)) {
      elementToDelete=AnaResourceFileHelper.getInstance().findAnalysis(file);
    }
 else     if (file.getFileExtension().equalsIgnoreCase(FactoriesUtil.REP)) {
      elementToDelete=RepResourceFileHelper.getInstance().findReport(file);
    }
    if (elementToDelete != null) {
      List<Resource> modifiedResources=DependenciesHandler.getInstance().clearDependencies(elementToDelete);
      EMFUtil util=EMFUtil.getInstance();
      util.getResourceSet().getResources().addAll(modifiedResources);
      if (!util.save()) {
        log.warn("String_Node_Str" + util.getLastErrorMessage());
      }
    }
  }
  CorePlugin.getDefault().refreshWorkSpace();
  DQRespositoryView findView=(DQRespositoryView)CorePlugin.getDefault().findView(DQRespositoryView.ID);
  findView.getCommonViewer().refresh();
}

Fixed version (ground truth):
private void removeDependencys(IResource[] resources){
  for (  IResource selectedObj : resources) {
    IFile file=((IFile)selectedObj);
    ModelElement elementToDelete=null;
    if (file.getFileExtension().equalsIgnoreCase(FactoriesUtil.PROV)) {
      TypedReturnCode<TdDataProvider> returnValue=PrvResourceFileHelper.getInstance().readFromFile(file);
      elementToDelete=returnValue.getObject();
    }
 else     if (file.getFileExtension().equalsIgnoreCase(FactoriesUtil.ANA)) {
      elementToDelete=AnaResourceFileHelper.getInstance().findAnalysis(file);
    }
 else     if (file.getFileExtension().equalsIgnoreCase(FactoriesUtil.REP)) {
      elementToDelete=RepResourceFileHelper.getInstance().findReport(file);
    }
    if (elementToDelete != null) {
      List<Resource> modifiedResources=DependenciesHandler.getInstance().clearDependencies(elementToDelete);
      EMFUtil util=EMFUtil.getInstance();
      for (      Resource resource : modifiedResources) {
        util.saveSingleResource(resource);
      }
    }
  }
  CorePlugin.getDefault().refreshWorkSpace();
  DQRespositoryView findView=(DQRespositoryView)CorePlugin.getDefault().findView(DQRespositoryView.ID);
  findView.getCommonViewer().refresh();
}
Program: 140732
Project: 140732
Buggy source:
@Override public boolean performFinish(){
  Pattern pattern=PatternFactory.eINSTANCE.createPattern();
  String name=AbstractWizardPage.getConnectionParams().getName();
  pattern.setName(name);
  RegularExpression regularExpr=PatternFactory.eINSTANCE.createRegularExpression();
  Expression expression=CoreFactory.eINSTANCE.createExpression();
  String expr=mPage2.getNameText().getText();
  expression.setBody(expr);
  expression.setLanguage("String_Node_Str");
  regularExpr.setExpression(expression);
  pattern.getComponents().add(regularExpr);
  EMFUtil util=EMFSharedResources.getSharedEmfUtil();
  IPath location=folder.getLocation();
  location=location.append(name);
  location=location.addFileExtension(NewSourcePatternActionProvider.EXTENSION_PATTERN);
  util.addPoolToResourceSet(new File(location.toPortableString()),pattern);
  util.save();
  return true;
}

Fixed version (ground truth):
@Override public boolean performFinish(){
  Pattern pattern=PatternFactory.eINSTANCE.createPattern();
  String name=AbstractWizardPage.getConnectionParams().getName();
  pattern.setName(name);
  RegularExpression regularExpr=PatternFactory.eINSTANCE.createRegularExpression();
  Expression expression=CoreFactory.eINSTANCE.createExpression();
  String expr=mPage2.getNameText().getText();
  expression.setBody(expr);
  expression.setLanguage("String_Node_Str");
  regularExpr.setExpression(expression);
  pattern.getComponents().add(regularExpr);
  EMFUtil util=EMFSharedResources.getSharedEmfUtil();
  IPath location=folder.getLocation();
  String fname=DqRepositoryViewService.createFilename(folder.getName(),name,NewSourcePatternActionProvider.EXTENSION_PATTERN);
  location=location.removeLastSegments(1);
  location=location.append(fname);
  util.addPoolToResourceSet(new File(location.toPortableString()),pattern);
  util.save();
  return true;
}
Program: 140734
Project: 140734
Buggy source:
/** 
 * Method "saveSingleResource" saves the given resource only. This method is a helper for saving quickly a given resource. It does not saved the related resources. This could result in an exception when other related resources should be saved with this resource.
 * @param resource the resource to save
 * @return true if no problem
 */
public boolean saveSingleResource(Resource resource){
  EMFUtil util=new EMFUtil();
  util.getResourceSet().getResources().add(resource);
  return util.save();
}

Fixed version (ground truth):
/** 
 * Method "saveSingleResource" saves the given resource only. This method is a helper for saving quickly a given resource. It does not saved the related resources. This could result in an exception when other related resources should be saved with this resource.
 * @param resource the resource to save
 * @return true if no problem
 */
public boolean saveSingleResource(Resource resource){
  EMFUtil util=new EMFUtil();
  util.getResourceSet().getResources().add(resource);
  boolean save=util.save();
  if (!save) {
    log.warn("String_Node_Str" + util.getLastErrorMessage());
  }
  return save;
}
Program: 140735
Project: 140735
Buggy source:
/** 
 * Method "saveResource" saves the given resource. This method is a helper for saving quickly a given resource and all its related resources (if any).
 * @param resource the resource to save
 * @return true if no problem
 */
public boolean saveResource(Resource resource){
  ResourceSet resourceSet=resource.getResourceSet();
  EMFUtil util=new EMFUtil();
  if (resourceSet != null) {
    util.setResourceSet(resourceSet);
    return util.save();
  }
  util.getResourceSet().getResources().add(resource);
  return util.save();
}

Fixed version (ground truth):
/** 
 * Method "saveResource" saves the given resource. This method is a helper for saving quickly a given resource and all its related resources (if any).
 * @param resource the resource to save
 * @return true if no problem
 */
public boolean saveResource(Resource resource){
  return saveSingleResource(resource);
}
Program: 140736
Project: 140736
Buggy source:
public boolean saveModifiedResources(){
  EMFUtil util=EMFUtil.getInstance();
  util.getResourceSet().getResources().addAll(this.modifiedResources);
  return util.save();
}

Fixed version (ground truth):
public boolean saveModifiedResources(){
  EMFUtil util=EMFUtil.getInstance();
  boolean saveFlag=true;
  Iterator<Resource> iterator=modifiedResources.iterator();
  while (iterator.hasNext()) {
    saveFlag=util.saveSingleResource(iterator.next());
    if (!saveFlag) {
      break;
    }
  }
  return saveFlag;
}
Program: 140737
Project: 140737
Buggy source:
/** 
 * DOC rli Comment method "addAnaResourceOfReport".
 * @param report
 * @param util
 */
private void addAnaResourceOfReport(TdReport report,EMFUtil util){
  for (  Analysis ana : ReportHelper.getAnalyses(report)) {
    TypedReturnCode<Dependency> dependencyReturn=DependenciesHandler.getInstance().setDependencyOn(report,ana);
    if (dependencyReturn.isOk()) {
      util.getResourceSet().getResources().add(ana.eResource());
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC rli Comment method "addAnaResourceOfReport".
 * @param report
 * @param util
 */
private void addAnaResourceOfReport(TdReport report,EMFUtil util){
  for (  Analysis ana : ReportHelper.getAnalyses(report)) {
    TypedReturnCode<Dependency> dependencyReturn=DependenciesHandler.getInstance().setDependencyOn(report,ana);
    if (dependencyReturn.isOk()) {
      util.saveSingleResource(ana.eResource());
    }
  }
}
Program: 140738
Project: 140738
Buggy source:
private static AnalysisCategories loadFromFile(){
  EMFUtil util=EMFUtil.getInstance();
  String pathName="String_Node_Str";
  URI uri=URI.createPlatformPluginURI(pathName,false);
  Resource catFile=null;
  try {
    catFile=util.getResourceSet().getResource(uri,true);
  }
 catch (  RuntimeException e) {
    log.error(e.getMessage());
  }
  if (catFile == null) {
    catFile=util.getResourceSet().getResource(URI.createFileURI("String_Node_Str" + File.separator + pathName),true);
  }
  if (catFile == null) {
    log.error("String_Node_Str" + pathName + "String_Node_Str"+ uri);
    return null;
  }
  EList<EObject> contents=catFile.getContents();
  if (contents == null) {
    log.error("String_Node_Str" + uri);
    return null;
  }
  CategorySwitch<AnalysisCategories> catSwitch=new CategorySwitch<AnalysisCategories>(){
    @Override public AnalysisCategories caseAnalysisCategories(    AnalysisCategories object){
      return object;
    }
  }
;
  return catSwitch.doSwitch(contents.get(0));
}

Fixed version (ground truth):
private static AnalysisCategories loadFromFile(){
  String pathName="String_Node_Str";
  URI uri=URI.createPlatformPluginURI(pathName,false);
  Resource catFile=null;
  ResourceSetImpl resourceSetImpl=new ResourceSetImpl();
  try {
    catFile=resourceSetImpl.getResource(uri,true);
  }
 catch (  RuntimeException e) {
    log.error(e.getMessage());
  }
  if (catFile == null) {
    catFile=resourceSetImpl.getResource(URI.createFileURI("String_Node_Str" + File.separator + pathName),true);
  }
  if (catFile == null) {
    log.error("String_Node_Str" + pathName + "String_Node_Str"+ uri);
    return null;
  }
  EList<EObject> contents=catFile.getContents();
  if (contents == null) {
    log.error("String_Node_Str" + uri);
    return null;
  }
  CategorySwitch<AnalysisCategories> catSwitch=new CategorySwitch<AnalysisCategories>(){
    @Override public AnalysisCategories caseAnalysisCategories(    AnalysisCategories object){
      return object;
    }
  }
;
  return catSwitch.doSwitch(contents.get(0));
}
Program: 140739
Project: 140739
Buggy source:
/** 
 * ADDED scorreia Method "computeDistinctValues".
 * @return the distinct values
 */
private Set<Object> computeDistinctValues(){
  Set<Object> keySet=this.valueToFreq.keySet();
  this.setDistinctValueCount(Long.valueOf(keySet.size()));
  distinctComputed=true;
  return keySet;
}

Fixed version (ground truth):
/** 
 * ADDED scorreia Method "computeDistinctValues" updates the distinctValues field and set distinctComputed field to true.
 */
private void computeDistinctValues(){
  this.distinctValues=this.valueToFreq.keySet();
  this.setDistinctValueCount(Long.valueOf(distinctValues.size()));
  distinctComputed=true;
}
Program: 140740
Project: 140740
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public Set<Object> getDistinctValues(){
  if (!distinctComputed) {
    distinctValues=computeDistinctValues();
  }
  return distinctValues;
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public Set<Object> getDistinctValues(){
  if (!distinctComputed) {
    computeDistinctValues();
  }
  return distinctValues;
}
Program: 140741
Project: 140741
Buggy source:
/** 
 * DOC scorreia Comment method "getValueFields".
 * @param value2freq
 * @return
 */
private Object getValueFields(Object[] value2freq){
  int nbFields=value2freq.length;
  if (nbFields == 2) {
    return value2freq[0];
  }
  StringBuffer buf=new StringBuffer();
  if (nbFields == 3) {
    Object year=value2freq[0];
    buf.append(year != null ? F4_DIGIT.format(year) : "String_Node_Str");
    Object quarter=value2freq[1];
    buf.append(String.valueOf(quarter));
    return buf.toString();
  }
  if (nbFields == 4) {
    Object year=value2freq[0];
    buf.append(year != null ? F4_DIGIT.format(year) : "String_Node_Str");
    Object month=String.valueOf(value2freq[2]);
    buf.append(month != null ? F2_DIGIT.format(month) : "String_Node_Str");
    return buf.toString();
  }
  if (nbFields == 5) {
    Object year=value2freq[0];
    buf.append(year != null ? F4_DIGIT.format(year) : "String_Node_Str");
    Object month=String.valueOf(value2freq[2]);
    buf.append(month != null ? F2_DIGIT.format(month) : "String_Node_Str");
    String week=String.valueOf(value2freq[3]);
    buf.append(week != null ? week : "String_Node_Str");
    return buf.toString();
  }
  if (nbFields == 6) {
    Object year=value2freq[0];
    buf.append(year != null ? F4_DIGIT.format(year) : "String_Node_Str");
    Object month=String.valueOf(value2freq[2]);
    buf.append(month != null ? F2_DIGIT.format(month) : "String_Node_Str");
    String day=String.valueOf(value2freq[4]);
    buf.append(day != null ? F2_DIGIT.format(day) : "String_Node_Str");
    return buf.toString();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "getValueFields".
 * @param value2freq
 * @return
 */
private Object getValueFields(Object[] value2freq){
  int nbFields=value2freq.length;
  if (nbFields == 2) {
    return value2freq[0];
  }
  StringBuffer buf=new StringBuffer();
  if (nbFields == 3) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object quarter=value2freq[1];
    buf.append(String.valueOf(quarter));
    return buf.toString();
  }
  if (nbFields == 4) {
    buf.append(format4digit(value2freq[0]));
    buf.append(format2digit(value2freq[2]));
    return buf.toString();
  }
  if (nbFields == 5) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object month=String.valueOf(value2freq[2]);
    buf.append(format2digit(month));
    String week=String.valueOf(value2freq[3]);
    buf.append(format1digit(week));
    return buf.toString();
  }
  if (nbFields == 6) {
    Object year=value2freq[0];
    buf.append(format4digit(year));
    Object month=String.valueOf(value2freq[2]);
    buf.append(format2digit(month));
    String day=String.valueOf(value2freq[4]);
    buf.append(format2digit(day));
    return buf.toString();
  }
  return null;
}
Program: 140743
Project: 140743
Buggy source:
/** 
 * Method "readFromFile".
 * @param file the file to read
 * @return the Data provider if found.
 */
private static TypedReturnCode<TdDataProvider> readFromFile(File file){
  TypedReturnCode<TdDataProvider> rc=new TypedReturnCode<TdDataProvider>();
  EMFUtil util=new EMFUtil();
  ResourceSet rs=util.getResourceSet();
  Resource r=rs.getResource(URI.createFileURI(file.getAbsolutePath()),true);
  Collection<TdDataProvider> tdDataProviders=DataProviderHelper.getTdDataProviders(r.getContents());
  if (tdDataProviders.isEmpty()) {
    rc.setReturnCode("String_Node_Str" + file.getAbsolutePath(),false);
  }
  if (tdDataProviders.size() > 1) {
    rc.setReturnCode("String_Node_Str" + tdDataProviders.size() + "String_Node_Str"+ file.getAbsolutePath(),false);
  }
  TdDataProvider prov=tdDataProviders.iterator().next();
  rc.setObject(prov);
  return rc;
}

Fixed version (ground truth):
/** 
 * Method "readFromFile".
 * @param file the file to read
 * @return the Data provider if found.
 */
private static TypedReturnCode<TdDataProvider> readFromFile(File file){
  TypedReturnCode<TdDataProvider> rc=new TypedReturnCode<TdDataProvider>();
  EMFUtil util=EMFUtil.getInstance();
  ResourceSet rs=util.getResourceSet();
  Resource r=rs.getResource(URI.createFileURI(file.getAbsolutePath()),true);
  Collection<TdDataProvider> tdDataProviders=DataProviderHelper.getTdDataProviders(r.getContents());
  if (tdDataProviders.isEmpty()) {
    rc.setReturnCode("String_Node_Str" + file.getAbsolutePath(),false);
  }
  if (tdDataProviders.size() > 1) {
    rc.setReturnCode("String_Node_Str" + tdDataProviders.size() + "String_Node_Str"+ file.getAbsolutePath(),false);
  }
  TdDataProvider prov=tdDataProviders.iterator().next();
  rc.setObject(prov);
  return rc;
}
Program: 140744
Project: 140744
Buggy source:
public boolean saveModifiedResources(){
  EMFUtil util=new EMFUtil();
  util.getResourceSet().getResources().addAll(this.modifiedResources);
  return util.save();
}

Fixed version (ground truth):
public boolean saveModifiedResources(){
  EMFUtil util=EMFUtil.getInstance();
  util.getResourceSet().getResources().addAll(this.modifiedResources);
  return util.save();
}
Program: 140745
Project: 140745
Buggy source:
private static AnalysisCategories loadFromFile(){
  EMFUtil util=new EMFUtil();
  String pathName="String_Node_Str";
  URI uri=URI.createPlatformPluginURI(pathName,false);
  Resource catFile=null;
  try {
    catFile=util.getResourceSet().getResource(uri,true);
  }
 catch (  RuntimeException e) {
    log.error(e.getMessage());
  }
  if (catFile == null) {
    catFile=util.getResourceSet().getResource(URI.createFileURI("String_Node_Str" + File.separator + pathName),true);
  }
  if (catFile == null) {
    log.error("String_Node_Str" + pathName + "String_Node_Str"+ uri);
    return null;
  }
  EList<EObject> contents=catFile.getContents();
  if (contents == null) {
    log.error("String_Node_Str" + uri);
    return null;
  }
  CategorySwitch<AnalysisCategories> catSwitch=new CategorySwitch<AnalysisCategories>(){
    @Override public AnalysisCategories caseAnalysisCategories(    AnalysisCategories object){
      return object;
    }
  }
;
  return catSwitch.doSwitch(contents.get(0));
}

Fixed version (ground truth):
private static AnalysisCategories loadFromFile(){
  EMFUtil util=EMFUtil.getInstance();
  String pathName="String_Node_Str";
  URI uri=URI.createPlatformPluginURI(pathName,false);
  Resource catFile=null;
  try {
    catFile=util.getResourceSet().getResource(uri,true);
  }
 catch (  RuntimeException e) {
    log.error(e.getMessage());
  }
  if (catFile == null) {
    catFile=util.getResourceSet().getResource(URI.createFileURI("String_Node_Str" + File.separator + pathName),true);
  }
  if (catFile == null) {
    log.error("String_Node_Str" + pathName + "String_Node_Str"+ uri);
    return null;
  }
  EList<EObject> contents=catFile.getContents();
  if (contents == null) {
    log.error("String_Node_Str" + uri);
    return null;
  }
  CategorySwitch<AnalysisCategories> catSwitch=new CategorySwitch<AnalysisCategories>(){
    @Override public AnalysisCategories caseAnalysisCategories(    AnalysisCategories object){
      return object;
    }
  }
;
  return catSwitch.doSwitch(contents.get(0));
}
Program: 140746
Project: 140746
Buggy source:
private Resource getResourceFromFile(){
  EMFUtil util=new EMFUtil();
  Resource definitionsFile=null;
  URI uri=URI.createPlatformResourceURI(WORKSPACE_PATH + FILENAME,false);
  try {
    definitionsFile=util.getResourceSet().getResource(uri,false);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + uri);
    }
  }
 catch (  RuntimeException e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + e.getMessage(),e);
    }
  }
  if (definitionsFile == null) {
    needCopy=true;
    uri=URI.createPlatformPluginURI(PLUGIN_PATH,false);
    try {
      definitionsFile=util.getResourceSet().getResource(uri,true);
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + uri);
      }
    }
 catch (    RuntimeException e) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + e.getMessage(),e);
      }
    }
  }
  if (definitionsFile == null) {
    definitionsFile=util.getResourceSet().getResource(URI.createFileURI("String_Node_Str" + File.separator + PLUGIN_PATH),true);
  }
  if (definitionsFile == null) {
    log.error("String_Node_Str" + PLUGIN_PATH + "String_Node_Str"+ uri);
    return null;
  }
  return definitionsFile;
}

Fixed version (ground truth):
private Resource getResourceFromFile(){
  EMFUtil util=EMFUtil.getInstance();
  Resource definitionsFile=null;
  URI uri=URI.createPlatformResourceURI(WORKSPACE_PATH + FILENAME,false);
  try {
    definitionsFile=util.getResourceSet().getResource(uri,false);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + uri);
    }
  }
 catch (  RuntimeException e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + e.getMessage(),e);
    }
  }
  if (definitionsFile == null) {
    needCopy=true;
    uri=URI.createPlatformPluginURI(PLUGIN_PATH,false);
    try {
      definitionsFile=util.getResourceSet().getResource(uri,true);
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + uri);
      }
    }
 catch (    RuntimeException e) {
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + e.getMessage(),e);
      }
    }
  }
  if (definitionsFile == null) {
    definitionsFile=util.getResourceSet().getResource(URI.createFileURI("String_Node_Str" + File.separator + PLUGIN_PATH),true);
  }
  if (definitionsFile == null) {
    log.error("String_Node_Str" + PLUGIN_PATH + "String_Node_Str"+ uri);
    return null;
  }
  return definitionsFile;
}
Program: 140747
Project: 140747
Buggy source:
public Resource copyDefinitionsIntoFolder(URI destinationUri){
  Resource resource=getIndicatorsDefinitions().eResource();
  EMFUtil.changeUri(resource,destinationUri);
  if (EMFUtil.saveResource(resource)) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + resource.getURI());
    }
  }
 else {
    log.error("String_Node_Str" + resource.getURI());
  }
  return resource;
}

Fixed version (ground truth):
public Resource copyDefinitionsIntoFolder(URI destinationUri){
  Resource resource=getIndicatorsDefinitions().eResource();
  EMFUtil.getInstance().changeUri(resource,destinationUri);
  if (EMFUtil.getInstance().saveResource(resource)) {
    if (log.isInfoEnabled()) {
      log.info("String_Node_Str" + resource.getURI());
    }
  }
 else {
    log.error("String_Node_Str" + resource.getURI());
  }
  return resource;
}
Program: 140748
Project: 140748
Buggy source:
/** 
 * DOC scorreia Comment method "createPatternMatchingIndicator".
 * @return
 */
private PatternMatchingIndicator createPatternMatchingIndicator(){
  PatternMatchingIndicator patternMatchingIndicator=IndicatorsFactory.eINSTANCE.createPatternMatchingIndicator();
  IndicatorParameters indicParams=IndicatorsFactory.eINSTANCE.createIndicatorParameters();
  Domain validData=DomainFactory.eINSTANCE.createDomain();
  Pattern pattern=PatternFactory.eINSTANCE.createPattern();
  pattern.setName("String_Node_Str");
  RegularExpression regularExpr=PatternFactory.eINSTANCE.createRegularExpression();
  Expression expression=CoreFactory.eINSTANCE.createExpression();
  expression.setBody(REGEXP);
  expression.setLanguage("String_Node_Str");
  regularExpr.setExpression(expression);
  pattern.getComponents().add(regularExpr);
  validData.getPatterns().add(pattern);
  indicParams.setDataValidDomain(validData);
  patternMatchingIndicator.setParameters(indicParams);
  EMFUtil util=new EMFUtil();
  util.addPoolToResourceSet(new File("String_Node_Str"),pattern);
  util.save();
  return patternMatchingIndicator;
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "createPatternMatchingIndicator".
 * @return
 */
private PatternMatchingIndicator createPatternMatchingIndicator(){
  PatternMatchingIndicator patternMatchingIndicator=IndicatorsFactory.eINSTANCE.createPatternMatchingIndicator();
  IndicatorParameters indicParams=IndicatorsFactory.eINSTANCE.createIndicatorParameters();
  Domain validData=DomainFactory.eINSTANCE.createDomain();
  Pattern pattern=PatternFactory.eINSTANCE.createPattern();
  pattern.setName("String_Node_Str");
  RegularExpression regularExpr=PatternFactory.eINSTANCE.createRegularExpression();
  Expression expression=CoreFactory.eINSTANCE.createExpression();
  expression.setBody(REGEXP);
  expression.setLanguage("String_Node_Str");
  regularExpr.setExpression(expression);
  pattern.getComponents().add(regularExpr);
  validData.getPatterns().add(pattern);
  indicParams.setDataValidDomain(validData);
  patternMatchingIndicator.setParameters(indicParams);
  EMFUtil util=EMFUtil.getInstance();
  util.addPoolToResourceSet(new File("String_Node_Str"),pattern);
  util.save();
  return patternMatchingIndicator;
}
Program: 140751
Project: 140751
Buggy source:
/** 
 * DOC scorreia Comment method "main".
 * @param args
 */
public static void main(String[] args){
  EMFUtil util=new EMFUtil();
  File file=new File("String_Node_Str" + IndicatorsPackage.eNAME);
  System.out.println("String_Node_Str" + file.getAbsolutePath());
  ResourceSet rs=util.getResourceSet();
  Resource r=rs.getResource(URI.createFileURI(file.getAbsolutePath()),true);
  EList<EObject> contents=r.getContents();
  if (contents.isEmpty()) {
    System.err.println("String_Node_Str" + r);
  }
  System.out.println("String_Node_Str" + contents.size());
  IndicatorsSwitch<FrequencyIndicator> mySwitch=new IndicatorsSwitch<FrequencyIndicator>(){
    @Override public FrequencyIndicator caseFrequencyIndicator(    FrequencyIndicator object){
      return object;
    }
  }
;
  for (  EObject object : contents) {
    FrequencyIndicator freqI=mySwitch.doSwitch(object);
    if (freqI != null) {
      Long uniqueValueCount=freqI.getUniqueValueCount();
      System.out.println("String_Node_Str" + uniqueValueCount);
      EList<Object> uniqueValues=freqI.getUniqueValues();
      for (      Object data : uniqueValues) {
        System.out.println("String_Node_Str" + data + "String_Node_Str"+ freqI.getCount(data));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC scorreia Comment method "main".
 * @param args
 */
public static void main(String[] args){
  EMFUtil util=EMFUtil.getInstance();
  File file=new File("String_Node_Str" + IndicatorsPackage.eNAME);
  System.out.println("String_Node_Str" + file.getAbsolutePath());
  ResourceSet rs=util.getResourceSet();
  Resource r=rs.getResource(URI.createFileURI(file.getAbsolutePath()),true);
  EList<EObject> contents=r.getContents();
  if (contents.isEmpty()) {
    System.err.println("String_Node_Str" + r);
  }
  System.out.println("String_Node_Str" + contents.size());
  IndicatorsSwitch<FrequencyIndicator> mySwitch=new IndicatorsSwitch<FrequencyIndicator>(){
    @Override public FrequencyIndicator caseFrequencyIndicator(    FrequencyIndicator object){
      return object;
    }
  }
;
  for (  EObject object : contents) {
    FrequencyIndicator freqI=mySwitch.doSwitch(object);
    if (freqI != null) {
      Long uniqueValueCount=freqI.getUniqueValueCount();
      System.out.println("String_Node_Str" + uniqueValueCount);
      EList<Object> uniqueValues=freqI.getUniqueValues();
      for (      Object data : uniqueValues) {
        System.out.println("String_Node_Str" + data + "String_Node_Str"+ freqI.getCount(data));
      }
    }
  }
}
Program: 140753
Project: 140753
Buggy source:
/** 
 * DOC qzhang Comment method "getPattern".
 * @param fe
 * @return
 */
protected static Pattern getPattern(IFile file){
  EMFUtil util=EMFUtil.getInstance();
  Resource resource=util.getResourceSet().getResource(URI.createPlatformResourceURI(file.getFullPath().toString()),true);
  Pattern pattern=(Pattern)EcoreUtil.getObjectByType(resource.getContents(),PatternPackage.eINSTANCE.getPattern());
  return pattern;
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "getPattern".
 * @param fe
 * @return
 */
public static Pattern getPattern(IFile file){
  EMFUtil util=EMFUtil.getInstance();
  Resource resource=util.getResourceSet().getResource(URI.createPlatformResourceURI(file.getFullPath().toString()),true);
  Pattern pattern=(Pattern)EcoreUtil.getObjectByType(resource.getContents(),PatternPackage.eINSTANCE.getPattern());
  return pattern;
}