nus-yam/ex-repair huggingface dataset:
Program: 138344
Project: 138344
Buggy source:
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  return Boolean.TRUE;
}

Fixed version (ground truth):
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  DatabaseConnection connection1=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj1);
  DatabaseConnection connection2=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj2);
  if (connection1 != null && connection2 != null) {
    changeUrl=ConnectionHelper.isUrlChanged(connection1);
  }
  return changeUrl ? false : super.isSimilar(obj1,obj2);
}
Program: 138345
Project: 138345
Buggy source:
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
  if (!isValid()) {
    return null;
  }
  oldDataProvider=upperCaseConnection(findDataProvider());
  if (oldDataProvider == null) {
    return null;
  }
  createTempConnectionFile();
  if (compareWithReloadObject()) {
    saveReloadResult();
  }
  return oldDataProvider;
}

Fixed version (ground truth):
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
  if (!isValid()) {
    return null;
  }
  oldDataProvider=upperCaseConnection(findDataProvider());
  if (oldDataProvider == null) {
    return null;
  }
  createTempConnectionFile();
  if (compareWithReloadObject()) {
    updateTaggedValue();
    saveReloadResult();
  }
  return oldDataProvider;
}
Program: 138346
Project: 138346
Buggy source:
public DQRepositoryViewLabelProvider(){
  super(MNComposedAdapterFactory.getAdapterFactory());
}

Fixed version (ground truth):
public DQRepositoryViewLabelProvider(){
  super(MNComposedAdapterFactory.getAdapterFactory());
  if (null == ITALIC_FONT) {
    ITALIC_FONT=Display.getDefault().getSystemFont();
    FontData[] exfds=ITALIC_FONT.getFontData();
    if (exfds.length > 0) {
      FontData fd=exfds[0];
      fd.setStyle(SWT.ITALIC);
      ITALIC_FONT=new Font(ITALIC_FONT.getDevice(),fd);
    }
  }
}
Program: 138347
Project: 138347
Buggy source:
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  DatabaseConnection connection1=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj1);
  DatabaseConnection connection2=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj2);
  if (connection1 != null && connection2 != null) {
    changeUrl=ConnectionHelper.isUrlChanged(connection1);
  }
  return changeUrl ? false : super.isSimilar(obj1,obj2);
}

Fixed version (ground truth):
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  return Boolean.TRUE;
}
Program: 138348
Project: 138348
Buggy source:
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
  if (!isValid()) {
    return null;
  }
  oldDataProvider=upperCaseConnection(findDataProvider());
  if (oldDataProvider == null) {
    return null;
  }
  createTempConnectionFile();
  if (compareWithReloadObject()) {
    updateTaggedValue();
    saveReloadResult();
  }
  return oldDataProvider;
}

Fixed version (ground truth):
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
  if (!isValid()) {
    return null;
  }
  oldDataProvider=upperCaseConnection(findDataProvider());
  if (oldDataProvider == null) {
    return null;
  }
  createTempConnectionFile();
  if (compareWithReloadObject()) {
    saveReloadResult();
  }
  return oldDataProvider;
}
Program: 138349
Project: 138349
Buggy source:
@Override public Font getFont(Object element){
  boolean changeURL=false;
  if (element instanceof IRepositoryNode) {
    IRepositoryNode node=(IRepositoryNode)element;
    ENodeType type=node.getType();
    if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
      if (node instanceof DBConnectionRepNode) {
        ConnectionItem connectionItem=(ConnectionItem)node.getObject().getProperty().getItem();
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          changeURL=ConnectionHelper.isUrlChanged(connectionItem.getConnection());
        }
      }
    }
  }
  return changeURL ? ITALIC_FONT : super.getFont(element);
}

Fixed version (ground truth):
@Override public Font getFont(Object element){
  boolean changeURL=false;
  if (element instanceof IRepositoryNode) {
    IRepositoryNode node=(IRepositoryNode)element;
    ENodeType type=node.getType();
    if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
      if (node instanceof DBConnectionRepNode) {
        ConnectionItem connectionItem=(ConnectionItem)node.getObject().getProperty().getItem();
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          changeURL=true;
        }
      }
    }
  }
  return changeURL ? ITALIC_FONT : super.getFont(element);
}
Program: 138350
Project: 138350
Buggy source:
/** 
 * Initialises the metadata, but only if the meta data has not already been collected
 */
private void initialise() throws SQLException {
  if (getConnection() != null)   return;
  _assistanceEnabled=SQLExplorerPlugin.getDefault().getPluginPreferences().getBoolean(IConstants.SQL_ASSIST);
  if (_assistanceEnabled) {
    dictionary=new Dictionary();
    DictionaryLoader dictionaryLoader=new DictionaryLoader(this);
    dictionaryLoader.schedule(500);
  }
  SQLConnection connection=null;
  try {
    connection=grabConnection();
    metaData=connection.getSQLMetaData();
    databaseProductName=metaData.getDatabaseProductName();
    dbModel=new DatabaseModel(this);
    try {
      if (metaData.supportsCatalogs())       catalogs=metaData.getCatalogs();
    }
 catch (    Exception e) {
      SQLExplorerPlugin.error(databaseProductName + "String_Node_Str" + e);
    }
  }
  finally {
    if (connection != null)     releaseConnection(connection);
  }
}

Fixed version (ground truth):
/** 
 * Initialises the metadata, but only if the meta data has not already been collected
 */
private void initialise() throws SQLException {
  if (getConnection() != null)   return;
  _assistanceEnabled=SQLExplorerPlugin.getDefault().getPluginPreferences().getBoolean(IConstants.SQL_ASSIST);
  if (_assistanceEnabled) {
    dictionary=new Dictionary();
    DictionaryLoader dictionaryLoader=new DictionaryLoader(this);
    dictionaryLoader.schedule(500);
  }
  SQLConnection connection=null;
  try {
    connection=grabConnection();
    metaData=connection.getSQLMetaData();
    databaseProductName=metaData.getDatabaseProductName();
    dbModel=new DatabaseModel(this);
    if (metaData.supportsCatalogs())     catalogs=metaData.getCatalogs();
  }
 catch (  SQLException sqlerror) {
    SQLExplorerPlugin.error(sqlerror);
  }
 finally {
    if (connection != null)     releaseConnection(connection);
  }
}
Program: 138352
Project: 138352
Buggy source:
/** 
 * DOC bZhou Comment method "getFileResource".
 * @param file
 * @return get null if the file is not exist.
 */
public synchronized Resource getFileResource(IFile file){
  if (file.exists()) {
    URI uri=URI.createPlatformResourceURI(file.getFullPath().toString(),false);
    Resource res=EMFSharedResources.getInstance().getResource(uri,false);
    if (res == null || res.getContents().isEmpty() || getModelElement(res) == null) {
      res=EMFSharedResources.getInstance().reloadResource(uri);
    }
    return res;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getFileResource".
 * @param file
 * @return get null if the file is not exist.
 */
public synchronized Resource getFileResource(IFile file){
  if (file.exists()) {
    URI uri=URI.createPlatformResourceURI(file.getFullPath().toString(),false);
    Resource res=EMFSharedResources.getInstance().getResource(uri,false);
    if (EMFSharedResources.getInstance().isNeedReload(res)) {
      res=EMFSharedResources.getInstance().reloadResource(uri);
    }
    return res;
  }
  return null;
}
Program: 138353
Project: 138353
Buggy source:
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  return Boolean.TRUE;
}

Fixed version (ground truth):
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  DatabaseConnection connection1=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj1);
  DatabaseConnection connection2=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj2);
  if (connection1 != null && connection2 != null) {
    changeUrl=ConnectionHelper.isUrlChanged(connection1);
  }
  return changeUrl ? false : super.isSimilar(obj1,obj2);
}
Program: 138354
Project: 138354
Buggy source:
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
  if (!isValid()) {
    return null;
  }
  oldDataProvider=upperCaseConnection(findDataProvider());
  if (oldDataProvider == null) {
    return null;
  }
  createTempConnectionFile();
  if (compareWithReloadObject()) {
    saveReloadResult();
  }
  return oldDataProvider;
}

Fixed version (ground truth):
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
  if (!isValid()) {
    return null;
  }
  oldDataProvider=upperCaseConnection(findDataProvider());
  if (oldDataProvider == null) {
    return null;
  }
  createTempConnectionFile();
  if (compareWithReloadObject()) {
    updateTaggedValue();
    saveReloadResult();
  }
  return oldDataProvider;
}
Program: 138355
Project: 138355
Buggy source:
@Override public Font getFont(Object element){
  boolean changeURL=false;
  if (element instanceof IRepositoryNode) {
    IRepositoryNode node=(IRepositoryNode)element;
    ENodeType type=node.getType();
    if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
      if (node instanceof DBConnectionRepNode) {
        ConnectionItem connectionItem=(ConnectionItem)node.getObject().getProperty().getItem();
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          changeURL=true;
        }
      }
    }
  }
  return changeURL ? ITALIC_FONT : super.getFont(element);
}

Fixed version (ground truth):
@Override public Font getFont(Object element){
  boolean changeURL=false;
  if (element instanceof IRepositoryNode) {
    IRepositoryNode node=(IRepositoryNode)element;
    ENodeType type=node.getType();
    if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
      if (node instanceof DBConnectionRepNode) {
        ConnectionItem connectionItem=(ConnectionItem)node.getObject().getProperty().getItem();
        if (connectionItem.getConnection() instanceof DatabaseConnection) {
          changeURL=ConnectionHelper.isUrlChanged(connectionItem.getConnection());
        }
      }
    }
  }
  return changeURL ? italicFont : super.getFont(element);
}
Program: 138356
Project: 138356
Buggy source:
public DQRepositoryViewLabelProvider(){
  super(MNComposedAdapterFactory.getAdapterFactory());
  if (null == ITALIC_FONT) {
    ITALIC_FONT=Display.getDefault().getSystemFont();
    FontData[] exfds=ITALIC_FONT.getFontData();
    if (exfds.length > 0) {
      FontData fd=exfds[0];
      fd.setStyle(SWT.ITALIC);
      ITALIC_FONT=new Font(ITALIC_FONT.getDevice(),fd);
    }
  }
}

Fixed version (ground truth):
public DQRepositoryViewLabelProvider(){
  super(MNComposedAdapterFactory.getAdapterFactory());
  if (null == italicFont) {
    italicFont=Display.getDefault().getSystemFont();
    FontData[] exfds=italicFont.getFontData();
    if (exfds.length > 0) {
      FontData fd=exfds[0];
      fd.setStyle(SWT.ITALIC);
      italicFont=new Font(italicFont.getDevice(),fd);
    }
  }
}
Program: 138357
Project: 138357
Buggy source:
public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  getPreferenceStore().setDefault(PluginConstant.CHEAT_SHEET_VIEW,true);
  try {
    for (    BookMarkEnum bookMark : BookMarkEnum.VALUES) {
      BaseHelpSystem.getBookmarkManager().addBookmark(bookMark.getHref(),bookMark.getLabel());
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  repositoryInitialized=this.initProxyRepository();
  SQLExplorerPlugin.getDefault().setRootProject(ReponsitoryContextBridge.getRootProject());
}

Fixed version (ground truth):
public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  getPreferenceStore().setDefault(PluginConstant.CHEAT_SHEET_VIEW,true);
  getPreferenceStore().setValue(ITalendCorePrefConstants.PREVIEW_LIMIT,"String_Node_Str");
  getPreferenceStore().setValue(ITalendCorePrefConstants.LANGUAGE_SELECTOR,Locale.getDefault().getLanguage());
  try {
    for (    BookMarkEnum bookMark : BookMarkEnum.VALUES) {
      BaseHelpSystem.getBookmarkManager().addBookmark(bookMark.getHref(),bookMark.getLabel());
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
  repositoryInitialized=this.initProxyRepository();
  SQLExplorerPlugin.getDefault().setRootProject(ReponsitoryContextBridge.getRootProject());
}
Program: 138358
Project: 138358
Buggy source:
public IPreferenceStore getPreferenceStore(){
  return null;
}

Fixed version (ground truth):
public IPreferenceStore getPreferenceStore(){
  return CorePlugin.getDefault().getPreferenceStore();
}
Program: 138359
Project: 138359
Buggy source:
public TdReport findReport(IFile file){
  if (checkFile(file)) {
    TdReport report=allRepMap.get(file);
    if (report == null) {
      report=readFromFile(file);
    }
    return report;
  }
  return null;
}

Fixed version (ground truth):
public TdReport findReport(IFile file){
  if (checkFile(file)) {
    TdReport report=allRepMap.get(file);
    if (report == null) {
      report=retireReport(getFileResource(file,true));
    }
    return report;
  }
  return null;
}
Program: 138361
Project: 138361
Buggy source:
@Override protected void doRun(){
  ISelection selection=getSelection();
  Object obj=((IStructuredSelection)selection).getFirstElement();
  final RepositoryNode node=(RepositoryNode)obj;
  final String title=DefaultMessagesImpl.getString("String_Node_Str");
  String message=null;
  if (node.getChildren().size() == 0) {
    return;
  }
 else   if (node.getChildren().size() >= 1) {
    message=DefaultMessagesImpl.getString("String_Node_Str") + "String_Node_Str" + DefaultMessagesImpl.getString("String_Node_Str");
  }
  final Shell shell=super.getShell();
  if (!(MessageDialog.openQuestion(shell,title,message))) {
    return;
  }
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  for (  IRepositoryNode child : node.getChildren()) {
    try {
      if (child.getType() == ENodeType.REPOSITORY_ELEMENT) {
        EObjectHelper.removeDependencys(RepositoryNodeHelper.getModelElementFromRepositoryNode(child));
      }
      deleteElements(factory,(RepositoryNode)child);
    }
 catch (    Exception e) {
      MessageBoxExceptionHandler.process(e);
    }
  }
  try {
    factory.saveProject(ProjectManager.getInstance().getCurrentProject());
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
@Override protected void doRun(){
  ISelection selection=getSelection();
  Object obj=((IStructuredSelection)selection).getFirstElement();
  final RepositoryNode node=(RepositoryNode)obj;
  final String title=DefaultMessagesImpl.getString("String_Node_Str");
  String message=null;
  if (node.getChildren().size() == 0) {
    return;
  }
 else   if (node.getChildren().size() >= 1) {
    message=DefaultMessagesImpl.getString("String_Node_Str") + "String_Node_Str" + DefaultMessagesImpl.getString("String_Node_Str");
  }
  final Shell shell=super.getShell();
  if (!(MessageDialog.openQuestion(shell,title,message))) {
    return;
  }
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
  for (  IRepositoryNode child : node.getChildren()) {
    try {
      if (child.getType() == ENodeType.REPOSITORY_ELEMENT) {
        ModelElement modelEle=RepositoryNodeHelper.getModelElementFromRepositoryNode(child);
        if (modelEle != null && modelEle instanceof TdReport) {
          IFile file=ResourceManager.getReportsFolder().getFile(WorkbenchUtils.getFilePath(node));
          if (file.exists()) {
            RepResourceFileHelper.getInstance().remove(file);
          }
        }
        EObjectHelper.removeDependencys(modelEle);
      }
      deleteElements(factory,(RepositoryNode)child);
    }
 catch (    Exception e) {
      MessageBoxExceptionHandler.process(e);
    }
  }
  try {
    factory.saveProject(ProjectManager.getInstance().getCurrentProject());
  }
 catch (  PersistenceException e) {
    ExceptionHandler.process(e);
  }
}
Program: 138362
Project: 138362
Buggy source:
@Override public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  super.finish(records,monitor);
  FilesUtils.removeFolder(sourcePath.toFile(),true);
}

Fixed version (ground truth):
@Override public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  super.finish(records,monitor);
  if (sourcePath != null && sourcePath.toFile().exists()) {
    FilesUtils.removeFolder(sourcePath.toFile(),true);
  }
}
Program: 138363
Project: 138363
Buggy source:
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  DatabaseConnection connection1=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj1);
  DatabaseConnection connection2=SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(obj2);
  if (connection1 != null && connection2 != null) {
    isChangedconnectionUrl=connection1.getURL().equals(connection2.getURL());
  }
  return isChangedconnectionUrl ? false : super.isSimilar(obj1,obj2);
}

Fixed version (ground truth):
@Override public boolean isSimilar(EObject obj1,EObject obj2) throws FactoryException {
  return Boolean.TRUE;
}
Program: 138364
Project: 138364
Buggy source:
protected void handleDiffPackageElement(DiffElement difElement){
  ModelElementChangeRightTarget addElement=addModelSwitch.doSwitch(difElement);
  if (addElement != null) {
    handleAddElement(addElement);
    return;
  }
  if (difElement instanceof UpdateAttribute) {
    handleUpdateElement((UpdateAttribute)difElement);
    return;
  }
  if (difElement instanceof ReferenceChangeLeftTarget) {
    handleReferenceValuesChange((ReferenceChangeLeftTarget)difElement);
    return;
  }
  if (difElement instanceof ReferenceChangeRightTarget) {
    handleReferenceValuesChange((ReferenceChangeRightTarget)difElement);
    return;
  }
  ModelElementChangeLeftTarget removeElement=removeModelSwitch.doSwitch(difElement);
  if (removeElement != null) {
    handleRemoveElement(removeElement);
  }
}

Fixed version (ground truth):
protected void handleDiffPackageElement(DiffElement difElement){
  DiffGroup diffGroup=diffGroupSwitch.doSwitch(difElement);
  if (diffGroup != null) {
    EList<DiffElement> subDiffElements=diffGroup.getSubDiffElements();
    for (    DiffElement de : subDiffElements) {
      handleDiffPackageElement(de);
    }
    return;
  }
  ModelElementChangeRightTarget addElement=addModelSwitch.doSwitch(difElement);
  if (addElement != null) {
    handleAddElement(addElement);
    return;
  }
  if (difElement instanceof UpdateAttribute) {
    handleUpdateElement((UpdateAttribute)difElement);
    return;
  }
  if (difElement instanceof ReferenceChangeLeftTarget) {
    handleReferenceValuesChange((ReferenceChangeLeftTarget)difElement);
    return;
  }
  if (difElement instanceof ReferenceChangeRightTarget) {
    handleReferenceValuesChange((ReferenceChangeRightTarget)difElement);
    return;
  }
  ModelElementChangeLeftTarget removeElement=removeModelSwitch.doSwitch(difElement);
  if (removeElement != null) {
    handleRemoveElement(removeElement);
  }
}
Program: 138365
Project: 138365
Buggy source:
private void initSwitchValue(){
  addModelSwitch=new DiffSwitch<ModelElementChangeRightTarget>(){
    @Override public ModelElementChangeRightTarget caseModelElementChangeRightTarget(    ModelElementChangeRightTarget object){
      return object;
    }
  }
;
  updateModelSwitch=new DiffSwitch<UpdateModelElement>(){
    public UpdateModelElement caseUpdateModelElement(    UpdateModelElement object){
      return object;
    }
  }
;
  removeModelSwitch=new DiffSwitch<ModelElementChangeLeftTarget>(){
    @Override public ModelElementChangeLeftTarget caseModelElementChangeLeftTarget(    ModelElementChangeLeftTarget object){
      return object;
    }
  }
;
  packageSwitch=new CoreSwitch<Package>(){
    public Package casePackage(    Package object){
      return object;
    }
  }
;
}

Fixed version (ground truth):
private void initSwitchValue(){
  addModelSwitch=new DiffSwitch<ModelElementChangeRightTarget>(){
    @Override public ModelElementChangeRightTarget caseModelElementChangeRightTarget(    ModelElementChangeRightTarget object){
      return object;
    }
  }
;
  updateModelSwitch=new DiffSwitch<UpdateModelElement>(){
    public UpdateModelElement caseUpdateModelElement(    UpdateModelElement object){
      return object;
    }
  }
;
  removeModelSwitch=new DiffSwitch<ModelElementChangeLeftTarget>(){
    @Override public ModelElementChangeLeftTarget caseModelElementChangeLeftTarget(    ModelElementChangeLeftTarget object){
      return object;
    }
  }
;
  packageSwitch=new CoreSwitch<Package>(){
    public Package casePackage(    Package object){
      return object;
    }
  }
;
  diffGroupSwitch=new DiffSwitch<DiffGroup>(){
    public DiffGroup caseDiffGroup(    DiffGroup object){
      return object;
    }
  }
;
}
Program: 138366
Project: 138366
Buggy source:
@Override protected void saveReloadResult(){
  RepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(oldDataProvider);
  Item item=recursiveFind.getObject().getProperty().getItem();
  ElementWriterFactory.getInstance().createDataProviderWriter().save(item);
}

Fixed version (ground truth):
@Override protected void saveReloadResult(){
  RepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(oldDataProvider);
  Item item=recursiveFind.getObject().getProperty().getItem();
  Project currentProject=ProjectManager.getInstance().getCurrentProject();
  try {
    ProxyRepositoryFactory.getInstance().save(currentProject,item);
  }
 catch (  PersistenceException e) {
    log.error(e,e);
  }
}
Program: 138367
Project: 138367
Buggy source:
@Override protected void updateDependencies(ModelElement element){
  Connection connection=(Connection)element;
  EList<Dependency> supplierDependency=connection.getSupplierDependency();
  try {
    for (    Dependency sDependency : supplierDependency) {
      EList<ModelElement> client=sDependency.getClient();
      for (      ModelElement me : client) {
        if (me instanceof Analysis) {
          Analysis analysis=(Analysis)me;
          TypedReturnCode<Dependency> dependencyReturn=DependenciesHandler.getInstance().setDependencyOn(analysis,connection);
          if (dependencyReturn.isOk()) {
            RepositoryNode repositoryNode=RepositoryNodeHelper.recursiveFind(analysis);
            if (repositoryNode != null) {
              TDQAnalysisItem analysisItem=(TDQAnalysisItem)repositoryNode.getObject().getProperty().getItem();
              analysisItem.setAnalysis(analysis);
            }
            ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(analysis.eResource());
          }
        }
      }
    }
  }
 catch (  PersistenceException e) {
    log.error(e,e);
  }
}

Fixed version (ground truth):
@Override protected void updateDependencies(ModelElement element){
  Connection connection=(Connection)element;
  EList<Dependency> supplierDependency=connection.getSupplierDependency();
  try {
    for (    Dependency sDependency : supplierDependency) {
      EList<ModelElement> client=sDependency.getClient();
      for (      ModelElement me : client) {
        if (me instanceof Analysis) {
          Analysis analysis=(Analysis)me;
          TypedReturnCode<Dependency> dependencyReturn=DependenciesHandler.getInstance().setDependencyOn(analysis,connection);
          if (dependencyReturn.isOk()) {
            RepositoryNode repositoryNode=RepositoryNodeHelper.recursiveFind(analysis);
            if (repositoryNode != null) {
              TDQAnalysisItem analysisItem=(TDQAnalysisItem)repositoryNode.getObject().getProperty().getItem();
              analysisItem.setAnalysis(analysis);
              ElementWriterFactory.getInstance().createAnalysisWrite().save(analysisItem);
            }
          }
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}
Program: 138370
Project: 138370
Buggy source:
@Override protected Connection findDataProvider(){
  Connection provider=null;
  if (selectedObj instanceof RepositoryNode) {
    Item connItem=((RepositoryNode)selectedObj).getObject().getProperty().getItem();
    provider=((ConnectionItem)connItem).getConnection();
  }
 else {
    TypedReturnCode<Connection> returnVlaue=PrvResourceFileHelper.getInstance().findProvider((IFile)selectedObj);
    provider=returnVlaue.getObject();
  }
  return provider;
}

Fixed version (ground truth):
@Override protected Connection findDataProvider(){
  Connection provider=null;
  if (selectedObj instanceof RepositoryNode) {
    Item connItem=((RepositoryNode)selectedObj).getObject().getProperty().getItem();
    provider=((ConnectionItem)connItem).getConnection();
  }
 else {
    provider=PrvResourceFileHelper.getInstance().findProvider((IFile)selectedObj);
  }
  return provider;
}
Program: 138371
Project: 138371
Buggy source:
public Connection getAdaptableProvider(Object element){
  Connection adaptedDataProvider=null;
  if (element instanceof IFile) {
    TypedReturnCode<Connection> returnVlaue=PrvResourceFileHelper.getInstance().findProvider((IFile)element);
    adaptedDataProvider=returnVlaue.getObject();
  }
 else   if (element instanceof IRepositoryViewObject) {
    Item item=((IRepositoryViewObject)element).getProperty().getItem();
    if (item instanceof ConnectionItem) {
      adaptedDataProvider=((ConnectionItem)item).getConnection();
    }
  }
 else   if (element instanceof Connection) {
    adaptedDataProvider=ConnectionUtils.fillConnectionMetadataInformation((Connection)element);
  }
 else {
    Package package1=SwitchHelpers.PACKAGE_SWITCH.doSwitch((ModelElement)element);
    if (package1 != null) {
      adaptedDataProvider=ConnectionHelper.getTdDataProvider(package1);
    }
 else {
      ColumnSet columnSet1=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch((ModelElement)element);
      if (columnSet1 != null) {
        adaptedDataProvider=ConnectionHelper.getDataProvider(columnSet1);
      }
 else {
        TdColumn column1=SwitchHelpers.COLUMN_SWITCH.doSwitch((TdColumn)element);
        if (column1 != null) {
          adaptedDataProvider=ConnectionHelper.getTdDataProvider(column1);
        }
      }
    }
  }
  return adaptedDataProvider;
}

Fixed version (ground truth):
public Connection getAdaptableProvider(Object element){
  Connection adaptedDataProvider=null;
  if (element instanceof IFile) {
    adaptedDataProvider=PrvResourceFileHelper.getInstance().findProvider((IFile)element);
  }
 else   if (element instanceof IRepositoryViewObject) {
    Item item=((IRepositoryViewObject)element).getProperty().getItem();
    if (item instanceof ConnectionItem) {
      adaptedDataProvider=((ConnectionItem)item).getConnection();
    }
  }
 else   if (element instanceof Connection) {
    adaptedDataProvider=ConnectionUtils.fillConnectionMetadataInformation((Connection)element);
  }
 else {
    Package package1=SwitchHelpers.PACKAGE_SWITCH.doSwitch((ModelElement)element);
    if (package1 != null) {
      adaptedDataProvider=ConnectionHelper.getTdDataProvider(package1);
    }
 else {
      ColumnSet columnSet1=SwitchHelpers.COLUMN_SET_SWITCH.doSwitch((ModelElement)element);
      if (columnSet1 != null) {
        adaptedDataProvider=ConnectionHelper.getDataProvider(columnSet1);
      }
 else {
        TdColumn column1=SwitchHelpers.COLUMN_SWITCH.doSwitch((TdColumn)element);
        if (column1 != null) {
          adaptedDataProvider=ConnectionHelper.getTdDataProvider(column1);
        }
      }
    }
  }
  return adaptedDataProvider;
}
Program: 138372
Project: 138372
Buggy source:
/** 
 * DOC bZhou Comment method "getALLElements".
 * @param withSystem
 * @return
 */
public static ModelElement[] getALLElements(boolean withSystem){
  Collection<Analysis> allAnalysis=AnaResourceFileHelper.getInstance().getAllAnalysis();
  Collection<WhereRule> allDQRules=DQRuleResourceFileHelper.getInstance().getAllDQRules();
  Collection<Pattern> allPatternes=PatternResourceFileHelper.getInstance().getAllPatternes();
  Collection<Connection> allDataProviders=new ArrayList<Connection>();
  try {
    for (    ConnectionItem connItem : ProxyRepositoryFactory.getInstance().getMetadataConnectionsItem()) {
      allDataProviders.add(connItem.getConnection());
    }
  }
 catch (  PersistenceException e) {
  }
  Collection<TdReport> allReports=RepResourceFileHelper.getInstance().getAllReports();
  Collection<IndicatorDefinition> allUDIs=IndicatorResourceFileHelper.getInstance().getAllUDIs();
  List<ModelElement> allElement=new ArrayList<ModelElement>();
  allElement.addAll(allAnalysis);
  allElement.addAll(allDQRules);
  allElement.addAll(allPatternes);
  allElement.addAll(allDataProviders);
  allElement.addAll(allReports);
  allElement.addAll(allUDIs);
  return allElement.toArray(new ModelElement[allElement.size()]);
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getALLElements".
 * @param withSystem
 * @return
 */
public static ModelElement[] getALLElements(boolean withSystem){
  List<ModelElement> allElement=ResourceFileMap.getAll();
  return allElement.toArray(new ModelElement[allElement.size()]);
}
Program: 138373
Project: 138373
Buggy source:
private void initRuleRepNode(WhereRule whereRule){
  RepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(whereRule);
  if (recursiveFind != null && recursiveFind instanceof RuleRepNode) {
    this.ruleRepNode=(RuleRepNode)recursiveFind;
    this.whereRuleItem=(TDQBusinessRuleItem)this.ruleRepNode.getObject().getProperty().getItem();
  }
}

Fixed version (ground truth):
private void initRuleRepNode(WhereRule whereRule){
  RepositoryNode recursiveFind=RepositoryNodeHelper.recursiveFind(whereRule);
  if (recursiveFind != null && recursiveFind instanceof RuleRepNode) {
    this.ruleRepNode=(RuleRepNode)recursiveFind;
    this.whereRuleItem=(TDQBusinessRuleItem)this.ruleRepNode.getObject().getProperty().getItem();
  }
 else {
    Property property=PropertyHelper.getProperty(whereRule);
    this.whereRuleItem=(TDQBusinessRuleItem)property.getItem();
  }
}
Program: 138375
Project: 138375
Buggy source:
@Override public void widgetSelected(SelectionEvent e){
  simpleStatIndicator.setStoreData(drillDownCheck.getSelection());
  setDirty(true);
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  storeDataCheck.setSelection(drillDownCheck.getSelection());
  simpleStatIndicator.setStoreData(drillDownCheck.getSelection());
  columnSetAnalysisHandler.getAnalysis().getParameters().setStoreData(drillDownCheck.getSelection());
  setDirty(true);
}
Program: 138382
Project: 138382
Buggy source:
private void excuteSuperRun(RepositoryNode currentNode){
  this.currentNode=currentNode;
  super.run();
  if (currentNode != null) {
    RepositoryNode parent=currentNode.getParent();
    if (parent != null && parent.getType() == ENodeType.SIMPLE_FOLDER) {
      parent.getChildren(true).remove(currentNode);
    }
  }
}

Fixed version (ground truth):
private void excuteSuperRun(RepositoryNode currentNode){
  this.currentNode=currentNode;
  super.run();
  if (currentNode != null) {
    RepositoryNode parent=currentNode.getParent();
    if (parent != null && (parent.getType() == ENodeType.SIMPLE_FOLDER || parent.getLabel().equalsIgnoreCase(ERepositoryObjectType.RECYCLE_BIN.name().replaceAll("String_Node_Str","String_Node_Str")))) {
      parent.getChildren(true).remove(currentNode);
    }
  }
}
Program: 138383
Project: 138383
Buggy source:
public DataSet getDataSet(){
  List<String> columnElementList=filterAdaptColumnHeader();
  columnHeader=new String[columnElementList.size()];
  int headerIndex=0;
  for (  String columnElement : columnElementList) {
    columnHeader[headerIndex++]=columnElement;
  }
  List<Object[]> newColumnElementList=filterAdaptDataList();
  if (newColumnElementList.size() <= 0) {
    columnValue=new String[0][0];
    return new DataSet(columnHeader,columnValue);
  }
  columnValue=new String[newColumnElementList.size()][columnElementList.size()];
  int rowIndex=0;
  for (  Object[] tableRow : newColumnElementList) {
    int columnIndex=0;
    for (    Object tableValue : tableRow) {
      columnValue[rowIndex][columnIndex++]=tableValue == null ? "String_Node_Str" : tableValue.toString();
    }
    rowIndex++;
  }
  return new DataSet(columnHeader,columnValue);
}

Fixed version (ground truth):
public DataSet getDataSet(){
  List<String> columnElementList=filterAdaptColumnHeader();
  columnHeader=new String[columnElementList.size()];
  int headerIndex=0;
  for (  String columnElement : columnElementList) {
    columnHeader[headerIndex++]=columnElement;
  }
  List<Object[]> newColumnElementList=filterAdaptDataList();
  if (newColumnElementList.size() <= 0) {
    columnValue=new String[0][0];
    return new DataSet(columnHeader,columnValue);
  }
  if (DrillDownEditorInput.judgeMenuType(getMenuType(),DrillDownEditorInput.MENU_VALUE_TYPE)) {
    columnValue=new String[newColumnElementList.size()][newColumnElementList.get(0).length];
  }
 else {
    columnValue=new String[newColumnElementList.size()][columnElementList.size()];
  }
  int rowIndex=0;
  for (  Object[] tableRow : newColumnElementList) {
    int columnIndex=0;
    for (    Object tableValue : tableRow) {
      columnValue[rowIndex][columnIndex++]=tableValue == null ? "String_Node_Str" : tableValue.toString();
    }
    rowIndex++;
  }
  return new DataSet(columnHeader,columnValue);
}
Program: 138384
Project: 138384
Buggy source:
/** 
 * zshen Comment method "getRepositoryFolderNode".
 * @param folderConstant
 * @return one RepositoryFolderNode which corresponding to the value of folderConstant
 */
public static IRepositoryNode getMetadataFolderNode(EResourceConstant folderConstant){
  String[] folderPathArray=folderConstant.getPath().split("String_Node_Str");
  if (folderPathArray.length <= 0) {
    return null;
  }
  IRepositoryNode node=getRootNode(ERepositoryObjectType.METADATA);
  for (int i=1; folderPathArray.length > i; i++) {
    for (    IRepositoryNode childNode : node.getChildren()) {
      if (childNode.getObject().getLabel().equalsIgnoreCase(folderPathArray[i])) {
        node=childNode;
        break;
      }
    }
  }
  return node;
}

Fixed version (ground truth):
/** 
 * zshen Comment method "getRepositoryFolderNode".
 * @param folderConstant
 * @return one RepositoryFolderNode which corresponding to the value of folderConstant
 */
public static IRepositoryNode getMetadataFolderNode(EResourceConstant folderConstant){
  String[] folderPathArray=folderConstant.getPath().split("String_Node_Str");
  if (folderPathArray.length <= 0) {
    return null;
  }
  IRepositoryNode node=getRootNode(ERepositoryObjectType.METADATA);
  if (node != null) {
    for (int i=1; folderPathArray.length > i; i++) {
      for (      IRepositoryNode childNode : node.getChildren()) {
        if (childNode.getObject().getLabel().equalsIgnoreCase(folderPathArray[i])) {
          node=childNode;
          break;
        }
      }
    }
  }
  return node;
}
Program: 138385
Project: 138385
Buggy source:
public static IRepositoryNode getLibrariesFolderNode(EResourceConstant folderConstant){
  String[] folderPathArray=folderConstant.getPath().split("String_Node_Str");
  if (folderPathArray.length <= 0) {
    return null;
  }
  IRepositoryNode node=getRootNode(ERepositoryObjectType.TDQ_LIBRARIES);
  for (int i=1; folderPathArray.length > i; i++) {
    for (    IRepositoryNode childNode : node.getChildren()) {
      if (childNode.getObject().getLabel().equalsIgnoreCase(folderPathArray[i])) {
        node=childNode;
        break;
      }
    }
  }
  return node;
}

Fixed version (ground truth):
public static IRepositoryNode getLibrariesFolderNode(EResourceConstant folderConstant){
  String[] folderPathArray=folderConstant.getPath().split("String_Node_Str");
  if (folderPathArray.length <= 0) {
    return null;
  }
  IRepositoryNode node=getRootNode(ERepositoryObjectType.TDQ_LIBRARIES);
  if (node != null) {
    for (int i=1; folderPathArray.length > i; i++) {
      for (      IRepositoryNode childNode : node.getChildren()) {
        if (childNode.getObject().getLabel().equalsIgnoreCase(folderPathArray[i])) {
          node=childNode;
          break;
        }
      }
    }
  }
  return node;
}
Program: 138386
Project: 138386
Buggy source:
public static IRepositoryNode getDataProfilingFolderNode(EResourceConstant folderConstant){
  String[] folderPathArray=folderConstant.getPath().split("String_Node_Str");
  if (folderPathArray.length <= 0) {
    return null;
  }
  IRepositoryNode node=getRootNode(ERepositoryObjectType.TDQ_DATA_PROFILING);
  for (int i=1; folderPathArray.length > i; i++) {
    for (    IRepositoryNode childNode : node.getChildren()) {
      if (childNode.getObject().getLabel().equalsIgnoreCase(folderPathArray[i])) {
        node=childNode;
        break;
      }
    }
  }
  return node;
}

Fixed version (ground truth):
public static IRepositoryNode getDataProfilingFolderNode(EResourceConstant folderConstant){
  String[] folderPathArray=folderConstant.getPath().split("String_Node_Str");
  if (folderPathArray.length <= 0) {
    return null;
  }
  IRepositoryNode node=getRootNode(ERepositoryObjectType.TDQ_DATA_PROFILING);
  if (node != null) {
    for (int i=1; folderPathArray.length > i; i++) {
      for (      IRepositoryNode childNode : node.getChildren()) {
        if (childNode.getObject().getLabel().equalsIgnoreCase(folderPathArray[i])) {
          node=childNode;
          break;
        }
      }
    }
  }
  return node;
}
Program: 138390
Project: 138390
Buggy source:
/** 
 * DOC qiongli Comment method "initAllFolder".
 */
private void initAllFolders(){
  Project newProject=ProjectManager.getInstance().getCurrentProject();
  List<FolderItem> folderItems=ProjectManager.getInstance().getFolders(newProject.getEmfProject());
  try {
    for (    FolderItem folder : new ArrayList<FolderItem>(folderItems)) {
      if (WorkbenchUtils.isTDQOrMetadataRootFolder(folder)) {
        ERepositoryObjectType type=WorkbenchUtils.getFolderContentType(folder);
        ProxyRepositoryFactory.getInstance().getAll(type,true);
      }
    }
  }
 catch (  PersistenceException e) {
    log.error(e,e);
  }
}

Fixed version (ground truth):
/** 
 * DOC qiongli Comment method "initAllFolder".
 */
private void initAllFolders(){
  Project newProject=ProjectManager.getInstance().getCurrentProject();
  List<FolderItem> folderItems=ProjectManager.getInstance().getFolders(newProject.getEmfProject());
  try {
    for (    FolderItem folder : new ArrayList<FolderItem>(folderItems)) {
      if (WorkbenchUtils.isTDQOrMetadataRootFolder(folder)) {
        ERepositoryObjectType type=WorkbenchUtils.getFolderContentType(folder);
        if (type != null) {
          ProxyRepositoryFactory.getInstance().getAll(type,true);
        }
      }
    }
  }
 catch (  PersistenceException e) {
    log.error(e,e);
  }
}
Program: 138392
Project: 138392
Buggy source:
@Override public void addDependencies(ModelElement element){
  TdReport report=(TdReport)element;
  for (  Analysis ana : ReportHelper.getAnalyses(report)) {
    TypedReturnCode<Dependency> dependencyReturn=DependenciesHandler.getInstance().setDependencyOn(report,ana);
    if (dependencyReturn.isOk()) {
      try {
        RepositoryNode repositoryNode=RepositoryNodeHelper.recursiveFind(ana);
        if (repositoryNode != null) {
          TDQAnalysisItem anaItem=(TDQAnalysisItem)repositoryNode.getObject().getProperty().getItem();
          anaItem.setAnalysis(ana);
        }
        ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(ana.eResource());
      }
 catch (      PersistenceException e) {
        log.error(e,e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void addDependencies(ModelElement element){
  TdReport report=(TdReport)element;
  for (  Analysis ana : ReportHelper.getAnalyses(report)) {
    TypedReturnCode<Dependency> dependencyReturn=DependenciesHandler.getInstance().setDependencyOn(report,ana);
    if (dependencyReturn.isOk()) {
      try {
        Property property=PropertyHelper.getProperty(ana);
        if (property != null) {
          TDQAnalysisItem anaItem=(TDQAnalysisItem)property.getItem();
          anaItem.setAnalysis(ana);
        }
        ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(ana.eResource());
      }
 catch (      PersistenceException e) {
        log.error(e,e);
      }
    }
  }
}
Program: 138394
Project: 138394
Buggy source:
/** 
 * get the (Resource) ModelElement from a node(include: connection, analysis, business rule, indicator definition, pattern, report), if there have not ModelElement return null.
 * @param node
 * @return
 */
public static ModelElement getResourceModelElement(IRepositoryNode node){
  if (node != null) {
    ENodeType nodeType=node.getType();
    if (ENodeType.REPOSITORY_ELEMENT.equals(nodeType) || ENodeType.TDQ_REPOSITORY_ELEMENT.equals(nodeType)) {
      IRepositoryViewObject object=node.getObject();
      if (object != null) {
        Property property=object.getProperty();
        if (property != null) {
          Item item=property.getItem();
          if (item != null && item instanceof TDQItem) {
            if (item instanceof TDQAnalysisItem) {
              return ((TDQAnalysisItem)item).getAnalysis();
            }
 else             if (item instanceof TDQBusinessRuleItem) {
              return ((TDQBusinessRuleItem)item).getDqrule();
            }
 else             if (item instanceof TDQIndicatorDefinitionItem) {
              return ((TDQIndicatorDefinitionItem)item).getIndicatorDefinition();
            }
 else             if (item instanceof TDQPatternItem) {
              return ((TDQPatternItem)item).getPattern();
            }
 else             if (item instanceof TDQReportItem) {
              return ((TDQReportItem)item).getReport();
            }
          }
 else           if (item != null && item instanceof ConnectionItem) {
            return ((ConnectionItem)item).getConnection();
          }
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * get the (Resource) ModelElement from a item(include: connection, analysis, business rule, indicator definition, pattern, report), if there have not ModelElement return null.
 * @param item
 * @return
 */
public static ModelElement getResourceModelElement(Item item){
  if (item != null && item instanceof TDQItem) {
    if (item instanceof TDQAnalysisItem) {
      return ((TDQAnalysisItem)item).getAnalysis();
    }
 else     if (item instanceof TDQBusinessRuleItem) {
      return ((TDQBusinessRuleItem)item).getDqrule();
    }
 else     if (item instanceof TDQIndicatorDefinitionItem) {
      return ((TDQIndicatorDefinitionItem)item).getIndicatorDefinition();
    }
 else     if (item instanceof TDQPatternItem) {
      return ((TDQPatternItem)item).getPattern();
    }
 else     if (item instanceof TDQReportItem) {
      return ((TDQReportItem)item).getReport();
    }
  }
 else   if (item != null && item instanceof ConnectionItem) {
    return ((ConnectionItem)item).getConnection();
  }
  return null;
}
Program: 138395
Project: 138395
Buggy source:
/** 
 * DOC bZhou Comment method "checkConflict".
 * @param record
 */
private void checkConflict(ItemRecord record){
  Property property=record.getProperty();
  if (property != null) {
    try {
      for (      ERepositoryObjectType type : RepositoryObjectTypeHelper.getDQResourceTypeList()) {
        List<IRepositoryViewObject> typedObjectList=ProxyRepositoryFactory.getInstance().getAll(type);
        for (        IRepositoryViewObject object : typedObjectList) {
          Property property2=object.getProperty();
          if (property.getId().equals(property2.getId())) {
            record.addError("String_Node_Str" + record.getName() + "String_Node_Str");
          }
        }
      }
    }
 catch (    Exception e) {
      record.addError("String_Node_Str" + record.getName() + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "checkConflict".
 * @param record
 */
private void checkConflict(ItemRecord record){
  Property property=record.getProperty();
  if (property != null) {
    try {
      RepositoryNode node=RepositoryNodeHelper.recursiveFind(property);
      if (node != null) {
        record.setConflictNode(node);
        record.addError("String_Node_Str" + record.getName() + "String_Node_Str");
      }
    }
 catch (    Exception e) {
      record.addError("String_Node_Str" + record.getName() + "String_Node_Str");
    }
  }
}
Program: 138397
Project: 138397
Buggy source:
@Override protected void run(){
  try {
    for (    ItemRecord record : fRecords) {
      if (fMonitor.isCanceled()) {
        break;
      }
      Map<IPath,IPath> toImportMap=mapping(record);
      fMonitor.subTask("String_Node_Str" + record.getName());
      if (record.isValid()) {
        log.info("String_Node_Str" + record.getFile().getAbsolutePath());
        for (        IPath resPath : toImportMap.keySet()) {
          IPath desPath=toImportMap.get(resPath);
synchronized (ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet) {
            write(resPath,desPath);
          }
        }
      }
 else {
        for (        String error : record.getErrors()) {
          log.error(error);
        }
      }
      fMonitor.worked(1);
    }
    finish(fRecords,fMonitor);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}

Fixed version (ground truth):
@Override protected void run(){
  try {
    for (    ItemRecord record : fRecords) {
      if (fMonitor.isCanceled()) {
        break;
      }
      Map<IPath,IPath> toImportMap=mapping(record);
      fMonitor.subTask("String_Node_Str" + record.getName());
      if (record.isValid()) {
        log.info("String_Node_Str" + record.getFile().getAbsolutePath());
        IRepositoryNode conflictNode=record.getConflictNode();
        if (conflictNode != null) {
          IRepositoryViewObject object=conflictNode.getObject();
          ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
        }
        for (        IPath resPath : toImportMap.keySet()) {
          IPath desPath=toImportMap.get(resPath);
          ResourceSet resourceSet=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet;
synchronized (resourceSet) {
            write(resPath,desPath);
          }
        }
      }
 else {
        for (        String error : record.getErrors()) {
          log.error(error);
        }
      }
      fMonitor.worked(1);
    }
    finish(fRecords,fMonitor);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}
Program: 138398
Project: 138398
Buggy source:
public ItemRecord[] populate(ItemRecord[] elements,boolean checkExisted){
  List<ItemRecord> inValidRecords=new ArrayList<ItemRecord>();
  for (  ItemRecord record : elements) {
    record.getErrors().clear();
    checkDependency(record);
    if (checkExisted) {
      checkExisted(record);
    }
    checkConflict(record);
    if (!record.isValid()) {
      inValidRecords.add(record);
    }
  }
  return inValidRecords.toArray(new ItemRecord[inValidRecords.size()]);
}

Fixed version (ground truth):
public ItemRecord[] populate(ItemRecord[] elements,boolean checkExisted){
  List<ItemRecord> inValidRecords=new ArrayList<ItemRecord>();
  for (  ItemRecord record : elements) {
    record.getErrors().clear();
    checkDependency(record);
    if (checkExisted) {
      checkExisted(record);
      checkConflict(record);
    }
    if (!record.isValid()) {
      inValidRecords.add(record);
    }
  }
  return inValidRecords.toArray(new ItemRecord[inValidRecords.size()]);
}