nus-yam/ex-repair huggingface dataset:
Program: 127726
Project: 127726
Buggy source:
private boolean validResourcePath(IResourceDelta delta,IPath topLevelNodeWorkspaceRelativePath,boolean refMerged){
  if (ingoreResource(delta)) {
    return false;
  }
  IResourceDelta[] affectedChildren=delta.getAffectedChildren();
  IPath path=delta.getFullPath();
  if (path != null && (affectedChildren.length == 0) && (FileConstants.PROPERTIES_EXTENSION.equals(path.getFileExtension()) || (delta instanceof IContainer))) {
    if (isMatchedPath(topLevelNodeWorkspaceRelativePath,path)) {
      return true;
    }
 else     if (refMerged) {
      path=path.removeFirstSegments(1);
      IPath relativePath=topLevelNodeWorkspaceRelativePath.removeFirstSegments(1);
      if (isMatchedPath(relativePath,path)) {
        return true;
      }
    }
  }
  if (affectedChildren != null) {
    for (    IResourceDelta child : affectedChildren) {
      if (validResourcePath(child,topLevelNodeWorkspaceRelativePath,refMerged)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean validResourcePath(IResourceDelta delta,IPath topLevelNodeWorkspaceRelativePath,boolean refMerged){
  if (ingoreResource(delta)) {
    return false;
  }
  IResourceDelta[] affectedChildren=delta.getAffectedChildren();
  IResource res=delta.getResource();
  IPath path=delta.getFullPath();
  boolean noChild=(affectedChildren == null || (affectedChildren.length == 0));
  if (path != null && noChild && (FileConstants.PROPERTIES_EXTENSION.equals(path.getFileExtension()) || (res instanceof IContainer))) {
    if (isMatchedPath(topLevelNodeWorkspaceRelativePath,path)) {
      return true;
    }
 else     if (refMerged) {
      if (res != null) {
        path=res.getProjectRelativePath();
      }
 else {
        path=path.removeFirstSegments(1);
      }
      IPath relativePath=topLevelNodeWorkspaceRelativePath.removeFirstSegments(1);
      if (isMatchedPath(relativePath,path)) {
        return true;
      }
    }
  }
  if (affectedChildren != null) {
    for (    IResourceDelta child : affectedChildren) {
      if (validResourcePath(child,topLevelNodeWorkspaceRelativePath,refMerged)) {
        return true;
      }
    }
  }
  return false;
}
Program: 127728
Project: 127728
Buggy source:
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (createChildNode(node)) {
    form.redrawLinkers();
  }
  form.updateConnection();
  form.updateStatus();
}

Fixed version (ground truth):
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (node != null && createChildNode(node)) {
    form.redrawLinkers();
  }
  form.updateConnection();
  form.updateStatus();
}
Program: 127730
Project: 127730
Buggy source:
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,400,100);
  addGroupRowsToSkip(mainComposite,300,100);
  addGroupEscapeChar(mainComposite,400,105);
  addGroupLimit(mainComposite,300,105);
  addGroupFileViewer(this,700,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}

Fixed version (ground truth):
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,400,105);
  addGroupRowsToSkip(mainComposite,300,105);
  addGroupEscapeChar(mainComposite,400,110);
  addGroupLimit(mainComposite,300,110);
  addGroupFileViewer(this,700,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}
Program: 127731
Project: 127731
Buggy source:
public void run(){
  handleErrorOutput(outputComposite,tabFolder,outputTabItem);
}

Fixed version (ground truth):
@Override public void run(){
  handleErrorOutput(outputComposite,tabFolder,outputTabItem);
}
Program: 127732
Project: 127732
Buggy source:
public void widgetDefaultSelected(SelectionEvent e){
}

Fixed version (ground truth):
@Override public void widgetDefaultSelected(SelectionEvent e){
}
Program: 127734
Project: 127734
Buggy source:
public void refresh(){
  refreshPreview();
}

Fixed version (ground truth):
@Override public void refresh(){
  refreshPreview();
}
Program: 127735
Project: 127735
Buggy source:
/** 
 * add Controls of Group Delimited File Settings.
 */
private void addFieldsListenersGroupDelimitedFileSettings(){
  encodingCombo.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      getConnection().setEncoding(encodingCombo.getText());
      checkFieldsValue();
    }
  }
);
  fieldSeparatorCombo.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      fieldSeparatorManager();
    }
  }
);
  rowSeparatorCombo.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      rowSeparatorManager();
    }
  }
);
  fieldSeparatorText.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      getConnection().setFieldSeparatorValue(fieldSeparatorText.getText());
      checkFieldsValue();
    }
  }
);
  fieldSeparatorText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
    }
  }
);
  rowSeparatorText.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      getConnection().setRowSeparatorValue(rowSeparatorText.getText());
      checkFieldsValue();
    }
  }
);
  rowSeparatorText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
    }
  }
);
}

Fixed version (ground truth):
/** 
 * add Controls of Group Delimited File Settings.
 */
private void addFieldsListenersGroupDelimitedFileSettings(){
  encodingCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      getConnection().setEncoding(encodingCombo.getText());
      checkFieldsValue();
    }
  }
);
  fieldSeparatorCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      fieldSeparatorManager();
    }
  }
);
  rowSeparatorCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      rowSeparatorManager();
    }
  }
);
  fieldSeparatorText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      getConnection().setFieldSeparatorValue(fieldSeparatorText.getText());
      checkFieldsValue();
    }
  }
);
  fieldSeparatorText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
    }
  }
);
  rowSeparatorText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      getConnection().setRowSeparatorValue(rowSeparatorText.getText());
      checkFieldsValue();
    }
  }
);
  rowSeparatorText.addKeyListener(new KeyAdapter(){
    @Override public void keyPressed(    KeyEvent e){
    }
  }
);
}
Program: 127736
Project: 127736
Buggy source:
public void modifyText(final ModifyEvent e){
  getConnection().setRowSeparatorValue(rowSeparatorText.getText());
  checkFieldsValue();
}

Fixed version (ground truth):
@Override public void modifyText(final ModifyEvent e){
  getConnection().setRowSeparatorValue(rowSeparatorText.getText());
  checkFieldsValue();
}
Program: 127737
Project: 127737
Buggy source:
@Override public void updateUIInThreadIfThreadIsNotCanceled(){
  if (previewInformationLabel.isDisposed()) {
    return;
  }
  previewInformationLabel.setText(previewInformationLabelMsg);
  if (getException() != null) {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    Display.getDefault().syncExec(new Runnable(){
      public void run(){
        handleErrorOutput(outputComposite,tabFolder,outputTabItem);
      }
    }
);
    return;
  }
  if (csvArray != null) {
    delimitedFilePreview.refreshTablePreview(csvArray,firstRowIsCatption);
  }
}

Fixed version (ground truth):
@Override public void updateUIInThreadIfThreadIsNotCanceled(){
  if (previewInformationLabel.isDisposed()) {
    return;
  }
  previewInformationLabel.setText(previewInformationLabelMsg);
  if (getException() != null) {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    Display.getDefault().syncExec(new Runnable(){
      @Override public void run(){
        handleErrorOutput(outputComposite,tabFolder,outputTabItem);
      }
    }
);
    return;
  }
  if (csvArray != null) {
    delimitedFilePreview.refreshTablePreview(csvArray,firstRowIsCatption);
  }
}
Program: 127739
Project: 127739
Buggy source:
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,280,80);
  addGroupRowsToSkip(mainComposite,300,80);
  addGroupDieOnErrorSettings(mainComposite,280,60);
  addGroupLimit(mainComposite,300,60);
  Composite mainComposite2=Form.startNewGridLayout(this,1);
  addGroupFileViewer(mainComposite2,600,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}

Fixed version (ground truth):
@Override protected void addFields(){
  Composite mainComposite=Form.startNewGridLayout(this,2);
  addGroupDelimitedFileSettings(mainComposite,280,120);
  addGroupRowsToSkip(mainComposite,300,120);
  addGroupDieOnErrorSettings(mainComposite,280,67);
  addGroupLimit(mainComposite,300,67);
  Composite mainComposite2=Form.startNewGridLayout(this,1);
  addGroupFileViewer(mainComposite2,600,200);
  if (!isInWizard()) {
    Composite compositeBottomButton=Form.startNewGridLayout(this,2,false,SWT.CENTER,SWT.CENTER);
    cancelButton=new UtilsButton(compositeBottomButton,Messages.getString("String_Node_Str"),WIDTH_BUTTON_PIXEL,HEIGHT_BUTTON_PIXEL);
  }
}
Program: 127740
Project: 127740
Buggy source:
public void run(){
  handleErrorOutput(outputComposite,tabFolder,outputTabItem);
}

Fixed version (ground truth):
@Override public void run(){
  handleErrorOutput(outputComposite,tabFolder,outputTabItem);
}
Program: 127741
Project: 127741
Buggy source:
public void refresh(){
  refreshPreview();
}

Fixed version (ground truth):
@Override public void refresh(){
  refreshPreview();
}
Program: 127742
Project: 127742
Buggy source:
/** 
 * add Controls of Group Delimited File Settings.
 */
private void addFieldsListenersGroupDelimitedFileSettings(){
  encodingCombo.addModifyListener(new ModifyListener(){
    public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setEncoding(encodingCombo.getText());
        checkFieldsValue();
      }
    }
  }
);
  advanceSeparatorCheckbox.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean select=advanceSeparatorCheckbox.getSelection();
      getConnection().setAdvancedSpearator(select);
      if (!isContextMode()) {
        decimalSeparatorText.setEnabled(select);
        thousandSeparaotrText.setEnabled(select);
        getConnection().setThousandSeparator(thousandSeparaotrText.getText());
        getConnection().setDecimalSeparator(decimalSeparatorText.getText());
        checkFieldsValue();
      }
    }
  }
);
  decimalSeparatorText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setDecimalSeparator(decimalSeparatorText.getText());
        checkFieldsValue();
      }
    }
  }
);
  thousandSeparaotrText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setThousandSeparator(thousandSeparaotrText.getText());
        checkFieldsValue();
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * add Controls of Group Delimited File Settings.
 */
private void addFieldsListenersGroupDelimitedFileSettings(){
  encodingCombo.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    final ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setEncoding(encodingCombo.getText());
        checkFieldsValue();
      }
    }
  }
);
  advanceSeparatorCheckbox.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      boolean select=advanceSeparatorCheckbox.getSelection();
      getConnection().setAdvancedSpearator(select);
      if (!isContextMode()) {
        decimalSeparatorText.setEnabled(select);
        thousandSeparaotrText.setEnabled(select);
        getConnection().setThousandSeparator(thousandSeparaotrText.getText());
        getConnection().setDecimalSeparator(decimalSeparatorText.getText());
        checkFieldsValue();
      }
    }
  }
);
  decimalSeparatorText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setDecimalSeparator(decimalSeparatorText.getText());
        checkFieldsValue();
      }
    }
  }
);
  thousandSeparaotrText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setThousandSeparator(thousandSeparaotrText.getText());
        checkFieldsValue();
      }
    }
  }
);
}
Program: 127743
Project: 127743
Buggy source:
public void modifyText(ModifyEvent e){
  if (!isContextMode()) {
    getConnection().setThousandSeparator(thousandSeparaotrText.getText());
    checkFieldsValue();
  }
}

Fixed version (ground truth):
@Override public void modifyText(ModifyEvent e){
  if (!isContextMode()) {
    getConnection().setThousandSeparator(thousandSeparaotrText.getText());
    checkFieldsValue();
  }
}
Program: 127744
Project: 127744
Buggy source:
@Override public void updateUIInThreadIfThreadIsNotCanceled(){
  if (previewInformationLabel.isDisposed()) {
    return;
  }
  previewInformationLabel.setText(previewInformationLabelMsg);
  if (getException() != null) {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        handleErrorOutput(outputComposite,tabFolder,outputTabItem);
      }
    }
);
    return;
  }
  if (csvArray == null) {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
  }
 else {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    excelProcessPreview.refreshTablePreview(csvArray,getConnection().isFirstLineCaption(),processDescription);
    previewInformationLabel.setText("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void updateUIInThreadIfThreadIsNotCanceled(){
  if (previewInformationLabel.isDisposed()) {
    return;
  }
  previewInformationLabel.setText(previewInformationLabelMsg);
  if (getException() != null) {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    Display.getDefault().asyncExec(new Runnable(){
      @Override public void run(){
        handleErrorOutput(outputComposite,tabFolder,outputTabItem);
      }
    }
);
    return;
  }
  if (csvArray == null) {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
  }
 else {
    previewInformationLabel.setText("String_Node_Str" + Messages.getString("String_Node_Str"));
    excelProcessPreview.refreshTablePreview(csvArray,getConnection().isFirstLineCaption(),processDescription);
    previewInformationLabel.setText("String_Node_Str");
  }
}
Program: 127745
Project: 127745
Buggy source:
private void addFieldsListenersDieOnError(){
  firstColumnText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setFirstColumn(firstColumnText.getText());
        checkFieldsValue();
      }
    }
  }
);
  lastColumnText.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setLastColumn(lastColumnText.getText());
        checkFieldsValue();
      }
    }
  }
);
}

Fixed version (ground truth):
private void addFieldsListenersDieOnError(){
  firstColumnText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setFirstColumn(firstColumnText.getText());
        checkFieldsValue();
      }
    }
  }
);
  lastColumnText.addModifyListener(new ModifyListener(){
    @Override public void modifyText(    ModifyEvent e){
      if (!isContextMode()) {
        getConnection().setLastColumn(lastColumnText.getText());
        checkFieldsValue();
      }
    }
  }
);
}
Program: 127748
Project: 127748
Buggy source:
@Override protected boolean visit(IResourceDelta delta,Collection<Runnable> runnables){
  VisitResourceHelper visitHelper=new VisitResourceHelper(delta);
  boolean merged=false;
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  for (  final RepositoryNode repoNode : topLevelNodes) {
    IProjectRepositoryNode root=repoNode.getRoot();
    if (!merged && root instanceof ProjectRepositoryNode) {
      merged=((ProjectRepositoryNode)root).getMergeRefProject();
    }
    IPath topLevelNodeWorkspaceRelativePath=topLevelNodeToPathMap.get(repoNode);
    if (topLevelNodeWorkspaceRelativePath != null && visitHelper.valid(topLevelNodeWorkspaceRelativePath,merged)) {
      if (viewer instanceof RepoViewCommonViewer) {
        runnables.add(new Runnable(){
          @Override public void run(){
            refreshTopLevelNode(repoNode);
          }
        }
);
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
@Override protected boolean visit(IResourceDelta delta,Collection<Runnable> runnables){
  VisitResourceHelper visitHelper=new VisitResourceHelper(delta);
  boolean merged=ProjectRepositoryNode.getInstance().getMergeRefProject();
  Set<RepositoryNode> topLevelNodes=getTopLevelNodes();
  for (  final RepositoryNode repoNode : topLevelNodes) {
    IPath topLevelNodeWorkspaceRelativePath=topLevelNodeToPathMap.get(repoNode);
    if (topLevelNodeWorkspaceRelativePath != null && visitHelper.valid(topLevelNodeWorkspaceRelativePath,merged)) {
      if (viewer instanceof RepoViewCommonViewer) {
        runnables.add(new Runnable(){
          @Override public void run(){
            refreshTopLevelNode(repoNode);
          }
        }
);
      }
      return false;
    }
 else {
      return true;
    }
  }
  return false;
}
Program: 127749
Project: 127749
Buggy source:
private boolean validResourcePath(IResourceDelta delta,IPath topLevelNodeWorkspaceRelativePath,boolean refMerged){
  if (ingoreResource(delta)) {
    return false;
  }
  IResourceDelta[] affectedChildren=delta.getAffectedChildren();
  IPath path=delta.getFullPath();
  if (path != null && (affectedChildren.length == 0) && (FileConstants.PROPERTIES_EXTENSION.equals(path.getFileExtension()) || (delta instanceof IContainer))) {
    if (isMatchedPath(topLevelNodeWorkspaceRelativePath,path)) {
      return true;
    }
 else     if (refMerged) {
      path=path.removeFirstSegments(1);
      IPath relativePath=topLevelNodeWorkspaceRelativePath.removeFirstSegments(1);
      if (isMatchedPath(relativePath,path)) {
        return true;
      }
    }
  }
  if (affectedChildren != null) {
    for (    IResourceDelta child : affectedChildren) {
      if (validResourcePath(child,topLevelNodeWorkspaceRelativePath,refMerged)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean validResourcePath(IResourceDelta delta,IPath topLevelNodeWorkspaceRelativePath,boolean refMerged){
  if (ingoreResource(delta)) {
    return false;
  }
  IResourceDelta[] affectedChildren=delta.getAffectedChildren();
  IResource res=delta.getResource();
  IPath path=delta.getFullPath();
  boolean noChild=(affectedChildren == null || (affectedChildren.length == 0));
  if (path != null && noChild && (FileConstants.PROPERTIES_EXTENSION.equals(path.getFileExtension()) || (res instanceof IContainer))) {
    if (isMatchedPath(topLevelNodeWorkspaceRelativePath,path)) {
      return true;
    }
 else     if (refMerged) {
      if (res != null) {
        path=res.getProjectRelativePath();
      }
 else {
        path=path.removeFirstSegments(1);
      }
      IPath relativePath=topLevelNodeWorkspaceRelativePath.removeFirstSegments(1);
      if (isMatchedPath(relativePath,path)) {
        return true;
      }
    }
  }
  if (affectedChildren != null) {
    for (    IResourceDelta child : affectedChildren) {
      if (validResourcePath(child,topLevelNodeWorkspaceRelativePath,refMerged)) {
        return true;
      }
    }
  }
  return false;
}
Program: 127751
Project: 127751
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  archiveRadioSelected();
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  if (addLogsButton.getSelection() == false && sysConfigButton.getSelection() == false) {
    setPageComplete(false);
  }
 else {
    setPageComplete(true);
  }
}
Program: 127752
Project: 127752
Buggy source:
@Before public void setUp(){
  allTypes=(ERepositoryObjectType[])ERepositoryObjectType.values();
  Arrays.sort(allTypes,new Comparator<ERepositoryObjectType>(){
    @Override public int compare(    ERepositoryObjectType o1,    ERepositoryObjectType o2){
      return o1.getType().compareToIgnoreCase(o2.getType());
    }
  }
);
}

Fixed version (ground truth):
@Before public void setUp(){
  allTypes=ERepositoryObjectType.values(ERepositoryObjectType.class);
  Arrays.sort(allTypes,new Comparator<ERepositoryObjectType>(){
    @Override public int compare(    ERepositoryObjectType o1,    ERepositoryObjectType o2){
      return o1.getType().compareToIgnoreCase(o2.getType());
    }
  }
);
  unusedTypes=new ArrayList<ERepositoryObjectType>();
  unusedTypes.add(ERepositoryObjectType.SVG_BUSINESS_PROCESS);
  unusedTypes.add(ERepositoryObjectType.SNIPPETS);
}
Program: 127753
Project: 127753
Buggy source:
@After public void tearDown() throws Exception {
  allTypes=null;
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  allTypes=null;
  unusedTypes.clear();
  unusedTypes=null;
}
Program: 127754
Project: 127754
Buggy source:
/** 
 * ggu Comment method "updateQuery". if show is false, will work for context menu action.
 */
public static boolean updateFileConnection(ConnectionItem connectionItem,boolean show,boolean onlySimpleShow){
  IProxyRepositoryFactory factory=CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
  List<IRepositoryViewObject> updateList=new ArrayList<IRepositoryViewObject>();
  List<RelationshipItemBuilder.Relation> relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(),RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.PROPERTY_RELATION);
  RepositoryUpdateManager repositoryUpdateManager=new RepositoryUpdateManager(connectionItem.getConnection(),relations){
    @Override public Set<EUpdateItemType> getTypes(){
      Set<EUpdateItemType> types=new HashSet<EUpdateItemType>();
      types.add(EUpdateItemType.NODE_PROPERTY);
      types.add(EUpdateItemType.NODE_SCHEMA);
      types.add(EUpdateItemType.JOB_PROPERTY_HEADERFOOTER);
      types.add(EUpdateItemType.NODE_SAP_IDOC);
      return types;
    }
  }
;
  return repositoryUpdateManager.doWork(show,onlySimpleShow);
}

Fixed version (ground truth):
/** 
 * ggu Comment method "updateQuery". if show is false, will work for context menu action.
 */
public static boolean updateFileConnection(ConnectionItem connectionItem,boolean show,boolean onlySimpleShow){
  List<RelationshipItemBuilder.Relation> relations=RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(),RelationshipItemBuilder.LATEST_VERSION,RelationshipItemBuilder.PROPERTY_RELATION);
  RepositoryUpdateManager repositoryUpdateManager=new RepositoryUpdateManager(connectionItem.getConnection(),relations){
    @Override public Set<EUpdateItemType> getTypes(){
      Set<EUpdateItemType> types=new HashSet<EUpdateItemType>();
      types.add(EUpdateItemType.NODE_PROPERTY);
      types.add(EUpdateItemType.NODE_SCHEMA);
      types.add(EUpdateItemType.JOB_PROPERTY_HEADERFOOTER);
      types.add(EUpdateItemType.NODE_SAP_IDOC);
      return types;
    }
  }
;
  return repositoryUpdateManager.doWork(show,onlySimpleShow);
}
Program: 127755
Project: 127755
Buggy source:
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (createChildNode(node)) {
    form.redrawLinkers();
  }
  form.updateConnection();
  form.updateStatus();
}

Fixed version (ground truth):
@Override public void run(){
  FOXTreeNode node=(FOXTreeNode)this.getStructuredSelection().getFirstElement();
  if (node != null && createChildNode(node)) {
    form.redrawLinkers();
  }
  form.updateConnection();
  form.updateStatus();
}
Program: 127758
Project: 127758
Buggy source:
/** 
 * Load emf model from file.
 * @param pkg EPackage of your emf model.
 * @param file The file that contains your emf model.
 * @return A list of emf object.
 * @throws IOException
 */
@SuppressWarnings("String_Node_Str") public static <T>List<T> loadEmfModel(EPackage pkg,String file) throws IOException {
  ResourceSet resourceSet=new ResourceSetImpl();
  Resource.Factory.Registry registry=resourceSet.getResourceFactoryRegistry();
  registry.getExtensionToFactoryMap().put("String_Node_Str",new EcoreResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMLResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMIResourceFactoryImpl());
  EPackage.Registry reg=resourceSet.getPackageRegistry();
  reg.put(pkg.getNsURI(),pkg);
  List<T> list=new ArrayList<T>();
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.getResource(uri,true);
  resource.load(null);
  for (  EObject obj : resource.getContents()) {
    list.add((T)obj);
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Load emf model from file.
 * @param pkg EPackage of your emf model.
 * @param file The file that contains your emf model.
 * @return A list of emf object.
 * @throws IOException
 */
@SuppressWarnings("String_Node_Str") public static <T>List<T> loadEmfModel(EPackage pkg,String file) throws IOException {
  ResourceSet resourceSet=getResourceSet(pkg);
  List<T> list=new ArrayList<T>();
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.getResource(uri,true);
  resource.load(null);
  for (  EObject obj : resource.getContents()) {
    list.add((T)obj);
  }
  return list;
}
Program: 127759
Project: 127759
Buggy source:
/** 
 * Save emf model to file.
 * @param pkg EPackage of your emf model.
 * @param models A list of emf object.
 * @param file The file that will store your emf model.
 * @throws IOException
 */
public static void saveEmfModel(EPackage pkg,List<? extends EObject> models,String file) throws IOException {
  ResourceSet resourceSet=new ResourceSetImpl();
  Resource.Factory.Registry registry=resourceSet.getResourceFactoryRegistry();
  registry.getExtensionToFactoryMap().put("String_Node_Str",new EcoreResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMLResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMIResourceFactoryImpl());
  EPackage.Registry reg=resourceSet.getPackageRegistry();
  reg.put(pkg.getNsURI(),pkg);
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.createResource(uri);
  for (  EObject model : models) {
    resource.getContents().add(model);
  }
  resource.save(null);
}

Fixed version (ground truth):
/** 
 * Save emf model to file.
 * @param pkg EPackage of your emf model.
 * @param models A list of emf object.
 * @param file The file that will store your emf model.
 * @throws IOException
 */
public static void saveEmfModel(EPackage pkg,List<? extends EObject> models,String file) throws IOException {
  ResourceSet resourceSet=getResourceSet(pkg);
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.createResource(uri);
  for (  EObject model : models) {
    resource.getContents().add(model);
  }
  resource.save(null);
}
Program: 127760
Project: 127760
Buggy source:
public static void saveResource(Resource resource) throws PersistenceException {
  if (resource == null) {
    return;
  }
  if (resource.getURI() == null) {
    return;
  }
  try {
    HashMap options=new HashMap(2);
    options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
    resource.save(options);
  }
 catch (  IOException e) {
    throw new PersistenceException(e);
  }
catch (  RuntimeException e) {
    log.warn("String_Node_Str" + resource.getURI() + "String_Node_Str",e);
    HashMap options=new HashMap(2);
    options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
    options.put(XMLResource.OPTION_XML_VERSION,"String_Node_Str");
    try {
      resource.save(options);
    }
 catch (    IOException e1) {
      throw new PersistenceException(e);
    }
  }
}

Fixed version (ground truth):
public static void saveResource(Resource resource) throws PersistenceException {
  if (resource == null) {
    return;
  }
  if (resource.getURI() == null) {
    return;
  }
  HashMap options=new HashMap(2);
  options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
  options.put(XMLResource.OPTION_ESCAPE_USING_CDATA,Boolean.TRUE);
  try {
    resource.save(options);
  }
 catch (  IOException e) {
    throw new PersistenceException(e);
  }
catch (  RuntimeException e) {
    log.warn("String_Node_Str" + resource.getURI() + "String_Node_Str",e);
    options.put(XMLResource.OPTION_XML_VERSION,"String_Node_Str");
    try {
      resource.save(options);
    }
 catch (    IOException e1) {
      throw new PersistenceException(e);
    }
  }
}
Program: 127761
Project: 127761
Buggy source:
@Override public Resource createResource(URI uri){
  String business="String_Node_Str";
  String context="String_Node_Str";
  String process="String_Node_Str";
  String joblet="String_Node_Str";
  if (uri.toString().contains("String_Node_Str" + business + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(business)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + context + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(context)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + process + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(process)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + joblet + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(joblet)) {
    return super.createResource(uri);
  }
 else {
    return new CwmResource(uri);
  }
}

Fixed version (ground truth):
@Override public Resource createResource(URI uri){
  String business="String_Node_Str";
  String context="String_Node_Str";
  String process="String_Node_Str";
  String joblet="String_Node_Str";
  if (validUrl(uri,business) || validUrl(uri,context) || validUrl(uri,process)|| validUrl(uri,joblet)) {
    return new TalendXMIResource(uri);
  }
 else {
    return new CwmResource(uri);
  }
}
Program: 127762
Project: 127762
Buggy source:
protected void evaluateTextField(){
  if (readOnly) {
    return;
  }
  if (nameText == null || nameText.isDisposed()) {
    return;
  }
  if (nameText.getText().length() == 0) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (!Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),nameText.getText()) || nameText.getText().trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (isKeywords(nameText.getText()) || "String_Node_Str".equalsIgnoreCase(nameText.getText())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(nameText.getText())) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (property != null && nameStatus.getSeverity() == IStatus.OK) {
    property.setLabel(getPropertyLabel(StringUtils.trimToNull(nameText.getText())));
    property.setDisplayName(StringUtils.trimToNull(nameText.getText()));
    property.setModificationDate(new Date());
  }
  updatePageStatus();
}

Fixed version (ground truth):
protected void evaluateTextField(){
  if (readOnly) {
    return;
  }
  if (nameText == null || nameText.isDisposed()) {
    return;
  }
  if (nameText.getText().length() == 0) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (!Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),nameText.getText()) || nameText.getText().trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (JavaConventions.validateClassFileName(nameText.getText() + CLASS).getSeverity() == IStatus.ERROR || "String_Node_Str".equalsIgnoreCase(nameText.getText())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(nameText.getText())) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (property != null && nameStatus.getSeverity() == IStatus.OK) {
    property.setLabel(getPropertyLabel(StringUtils.trimToNull(nameText.getText())));
    property.setDisplayName(StringUtils.trimToNull(nameText.getText()));
    property.setModificationDate(new Date());
  }
  updatePageStatus();
}
Program: 127764
Project: 127764
Buggy source:
/** 
 * Load emf model from file.
 * @param pkg EPackage of your emf model.
 * @param file The file that contains your emf model.
 * @return A list of emf object.
 * @throws IOException
 */
@SuppressWarnings("String_Node_Str") public static <T>List<T> loadEmfModel(EPackage pkg,String file) throws IOException {
  ResourceSet resourceSet=new ResourceSetImpl();
  Resource.Factory.Registry registry=resourceSet.getResourceFactoryRegistry();
  registry.getExtensionToFactoryMap().put("String_Node_Str",new EcoreResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMLResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMIResourceFactoryImpl());
  EPackage.Registry reg=resourceSet.getPackageRegistry();
  reg.put(pkg.getNsURI(),pkg);
  List<T> list=new ArrayList<T>();
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.getResource(uri,true);
  resource.load(null);
  for (  EObject obj : resource.getContents()) {
    list.add((T)obj);
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Load emf model from file.
 * @param pkg EPackage of your emf model.
 * @param file The file that contains your emf model.
 * @return A list of emf object.
 * @throws IOException
 */
@SuppressWarnings("String_Node_Str") public static <T>List<T> loadEmfModel(EPackage pkg,String file) throws IOException {
  ResourceSet resourceSet=getResourceSet(pkg);
  List<T> list=new ArrayList<T>();
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.getResource(uri,true);
  resource.load(null);
  for (  EObject obj : resource.getContents()) {
    list.add((T)obj);
  }
  return list;
}
Program: 127765
Project: 127765
Buggy source:
/** 
 * Save emf model to file.
 * @param pkg EPackage of your emf model.
 * @param models A list of emf object.
 * @param file The file that will store your emf model.
 * @throws IOException
 */
public static void saveEmfModel(EPackage pkg,List<? extends EObject> models,String file) throws IOException {
  ResourceSet resourceSet=new ResourceSetImpl();
  Resource.Factory.Registry registry=resourceSet.getResourceFactoryRegistry();
  registry.getExtensionToFactoryMap().put("String_Node_Str",new EcoreResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMLResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMIResourceFactoryImpl());
  EPackage.Registry reg=resourceSet.getPackageRegistry();
  reg.put(pkg.getNsURI(),pkg);
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.createResource(uri);
  for (  EObject model : models) {
    resource.getContents().add(model);
  }
  resource.save(null);
}

Fixed version (ground truth):
/** 
 * Save emf model to file.
 * @param pkg EPackage of your emf model.
 * @param models A list of emf object.
 * @param file The file that will store your emf model.
 * @throws IOException
 */
public static void saveEmfModel(EPackage pkg,List<? extends EObject> models,String file) throws IOException {
  ResourceSet resourceSet=getResourceSet(pkg);
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.createResource(uri);
  for (  EObject model : models) {
    resource.getContents().add(model);
  }
  resource.save(null);
}
Program: 127766
Project: 127766
Buggy source:
public static void saveResource(Resource resource) throws PersistenceException {
  if (resource == null) {
    return;
  }
  if (resource.getURI() == null) {
    return;
  }
  try {
    HashMap options=new HashMap(2);
    options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
    resource.save(options);
  }
 catch (  IOException e) {
    throw new PersistenceException(e);
  }
catch (  RuntimeException e) {
    log.warn("String_Node_Str" + resource.getURI() + "String_Node_Str",e);
    HashMap options=new HashMap(2);
    options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
    options.put(XMLResource.OPTION_XML_VERSION,"String_Node_Str");
    try {
      resource.save(options);
    }
 catch (    IOException e1) {
      throw new PersistenceException(e);
    }
  }
}

Fixed version (ground truth):
public static void saveResource(Resource resource) throws PersistenceException {
  if (resource == null) {
    return;
  }
  if (resource.getURI() == null) {
    return;
  }
  HashMap options=new HashMap(2);
  options.put(XMLResource.OPTION_ENCODING,"String_Node_Str");
  options.put(XMLResource.OPTION_ESCAPE_USING_CDATA,Boolean.TRUE);
  try {
    resource.save(options);
  }
 catch (  IOException e) {
    throw new PersistenceException(e);
  }
catch (  RuntimeException e) {
    log.warn("String_Node_Str" + resource.getURI() + "String_Node_Str",e);
    options.put(XMLResource.OPTION_XML_VERSION,"String_Node_Str");
    try {
      resource.save(options);
    }
 catch (    IOException e1) {
      throw new PersistenceException(e);
    }
  }
}
Program: 127767
Project: 127767
Buggy source:
@Override public Resource createResource(URI uri){
  String business="String_Node_Str";
  String context="String_Node_Str";
  String process="String_Node_Str";
  String joblet="String_Node_Str";
  if (uri.toString().contains("String_Node_Str" + business + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(business)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + context + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(context)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + process + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(process)) {
    return super.createResource(uri);
  }
 else   if (uri.toString().contains("String_Node_Str" + joblet + "String_Node_Str") && uri.segmentCount() > 2 && uri.segments()[2].equals(joblet)) {
    return super.createResource(uri);
  }
 else {
    return new CwmResource(uri);
  }
}

Fixed version (ground truth):
@Override public Resource createResource(URI uri){
  String business="String_Node_Str";
  String context="String_Node_Str";
  String process="String_Node_Str";
  String joblet="String_Node_Str";
  if (validUrl(uri,business) || validUrl(uri,context) || validUrl(uri,process)|| validUrl(uri,joblet)) {
    return new TalendXMIResource(uri);
  }
 else {
    return new CwmResource(uri);
  }
}
Program: 127771
Project: 127771
Buggy source:
protected void evaluateTextField(){
  if (readOnly) {
    return;
  }
  if (nameText == null || nameText.isDisposed()) {
    return;
  }
  if (nameText.getText().length() == 0) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (!Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),nameText.getText()) || nameText.getText().trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (JavaConventions.validateClassFileName(nameText.getText() + CLASS).getSeverity() == IStatus.ERROR || "String_Node_Str".equalsIgnoreCase(nameText.getText())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(nameText.getText())) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (property != null && nameStatus.getSeverity() == IStatus.OK) {
    property.setLabel(getPropertyLabel(StringUtils.trimToNull(nameText.getText())));
    property.setDisplayName(StringUtils.trimToNull(nameText.getText()));
    property.setModificationDate(new Date());
  }
  updatePageStatus();
}

Fixed version (ground truth):
protected void evaluateTextField(){
  if (readOnly) {
    return;
  }
  if (nameText == null || nameText.isDisposed()) {
    return;
  }
  if (nameText.getText().length() == 0) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (!Pattern.matches(RepositoryConstants.getPattern(getRepositoryObjectType()),nameText.getText()) || nameText.getText().trim().contains("String_Node_Str")) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (JavaConventions.validateClassFileName(nameText.getText() + CLASS,JavaCore.getOption(JavaCore.COMPILER_SOURCE),JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE)).getSeverity() == IStatus.ERROR || "String_Node_Str".equalsIgnoreCase(nameText.getText())) {
    nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
  }
 else   if (nameModifiedByUser) {
    if (retrieveNameFinished) {
      if (!isValid(nameText.getText())) {
        nameStatus=createStatus(IStatus.ERROR,Messages.getString("String_Node_Str"));
      }
 else {
        nameStatus=createOkStatus();
      }
    }
 else {
      nameStatus=createStatus(IStatus.ERROR,"String_Node_Str");
    }
  }
 else {
    nameStatus=createOkStatus();
  }
  if (property != null && nameStatus.getSeverity() == IStatus.OK) {
    property.setLabel(getPropertyLabel(StringUtils.trimToNull(nameText.getText())));
    property.setDisplayName(StringUtils.trimToNull(nameText.getText()));
    property.setModificationDate(new Date());
  }
  updatePageStatus();
}
Program: 127773
Project: 127773
Buggy source:
/** 
 * Load emf model from file.
 * @param pkg EPackage of your emf model.
 * @param file The file that contains your emf model.
 * @return A list of emf object.
 * @throws IOException
 */
@SuppressWarnings("String_Node_Str") public static <T>List<T> loadEmfModel(EPackage pkg,String file) throws IOException {
  ResourceSet resourceSet=new ResourceSetImpl();
  Resource.Factory.Registry registry=resourceSet.getResourceFactoryRegistry();
  registry.getExtensionToFactoryMap().put("String_Node_Str",new EcoreResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMLResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMIResourceFactoryImpl());
  EPackage.Registry reg=resourceSet.getPackageRegistry();
  reg.put(pkg.getNsURI(),pkg);
  List<T> list=new ArrayList<T>();
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.getResource(uri,true);
  resource.load(null);
  for (  EObject obj : resource.getContents()) {
    list.add((T)obj);
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Load emf model from file.
 * @param pkg EPackage of your emf model.
 * @param file The file that contains your emf model.
 * @return A list of emf object.
 * @throws IOException
 */
@SuppressWarnings("String_Node_Str") public static <T>List<T> loadEmfModel(EPackage pkg,String file) throws IOException {
  ResourceSet resourceSet=getResourceSet(pkg);
  List<T> list=new ArrayList<T>();
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.getResource(uri,true);
  resource.load(null);
  for (  EObject obj : resource.getContents()) {
    list.add((T)obj);
  }
  return list;
}
Program: 127774
Project: 127774
Buggy source:
/** 
 * Save emf model to file.
 * @param pkg EPackage of your emf model.
 * @param models A list of emf object.
 * @param file The file that will store your emf model.
 * @throws IOException
 */
public static void saveEmfModel(EPackage pkg,List<? extends EObject> models,String file) throws IOException {
  ResourceSet resourceSet=new ResourceSetImpl();
  Resource.Factory.Registry registry=resourceSet.getResourceFactoryRegistry();
  registry.getExtensionToFactoryMap().put("String_Node_Str",new EcoreResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMLResourceFactoryImpl());
  registry.getExtensionToFactoryMap().put("String_Node_Str",new XMIResourceFactoryImpl());
  EPackage.Registry reg=resourceSet.getPackageRegistry();
  reg.put(pkg.getNsURI(),pkg);
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.createResource(uri);
  for (  EObject model : models) {
    resource.getContents().add(model);
  }
  resource.save(null);
}

Fixed version (ground truth):
/** 
 * Save emf model to file.
 * @param pkg EPackage of your emf model.
 * @param models A list of emf object.
 * @param file The file that will store your emf model.
 * @throws IOException
 */
public static void saveEmfModel(EPackage pkg,List<? extends EObject> models,String file) throws IOException {
  ResourceSet resourceSet=getResourceSet(pkg);
  URI uri=URI.createFileURI(file);
  Resource resource=resourceSet.createResource(uri);
  for (  EObject model : models) {
    resource.getContents().add(model);
  }
  resource.save(null);
}