Program: 137495
Project: 137495
Buggy source:
public void write(ItemRecord[] records,IProgressMonitor monitor){
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  final ItemRecord[] fRecords=records;
  final IProgressMonitor fMonitor=monitor;
  RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str"){
    @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());
            IRepositoryViewObject object=record.getConflictObject();
            boolean isDelete=true;
            ModelElement modEle=record.getElement();
            if (object != null) {
              if (isIndicator(modEle)) {
                mergeSystemIndicator(record,(TDQIndicatorDefinitionItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isParserRule(modEle)) {
                mergeParserRule(record,(TDQBusinessRuleItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isPattern(modEle)) {
                mergePattern(record,(TDQPatternItem)object.getProperty().getItem());
                isDelete=false;
              }
            }
            if (isDelete) {
              for (              IPath resPath : toImportMap.keySet()) {
                IPath desPath=toImportMap.get(resPath);
                ResourceSet resourceSet=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet;
synchronized (resourceSet) {
                  write(resPath,desPath);
                  allCopiedFiles.add(desPath.toFile());
                }
              }
            }
          }
 else {
            for (            String error : record.getErrors()) {
              log.error(error);
            }
          }
          fMonitor.worked(1);
        }
        finish(fRecords,fMonitor);
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
;
  workUnit.setAvoidUnloadResources(Boolean.TRUE);
  ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
}

Fixed version (ground truth):
public void write(ItemRecord[] records,IProgressMonitor monitor){
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  final ItemRecord[] fRecords=records;
  final IProgressMonitor fMonitor=monitor;
  RepositoryWorkUnit<Object> workUnit=new RepositoryWorkUnit<Object>("String_Node_Str"){
    @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());
            IRepositoryViewObject object=record.getConflictObject();
            boolean isDelete=true;
            ModelElement modEle=record.getElement();
            if (object != null) {
              if (isIndicator(modEle)) {
                mergeSystemIndicator(record,(TDQIndicatorDefinitionItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isParserRule(modEle)) {
                mergeParserRule(record,(TDQBusinessRuleItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isPattern(modEle)) {
                mergePattern(record,(TDQPatternItem)object.getProperty().getItem());
                isDelete=false;
              }
 else {
                ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
              }
            }
            if (isDelete) {
              for (              IPath resPath : toImportMap.keySet()) {
                IPath desPath=toImportMap.get(resPath);
                ResourceSet resourceSet=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet;
synchronized (resourceSet) {
                  write(resPath,desPath);
                  allCopiedFiles.add(desPath.toFile());
                }
              }
            }
          }
 else {
            for (            String error : record.getErrors()) {
              log.error(error);
            }
          }
          fMonitor.worked(1);
        }
        finish(fRecords,fMonitor);
      }
 catch (      Exception e) {
        log.error(e,e);
      }
    }
  }
;
  workUnit.setAvoidUnloadResources(Boolean.TRUE);
  ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
}