Program: 137493
Project: 137493
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;
            if (object != null) {
              if (isIndicator(record.getElement())) {
                mergeSystemIndicator(record,(TDQIndicatorDefinitionItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isParserRule(record.getElement())) {
                mergeParserRule(record,(TDQBusinessRuleItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isPattern(record.getElement())) {
                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;
            if (object != null) {
              if (isIndicator(record.getElement())) {
                mergeSystemIndicator(record,(TDQIndicatorDefinitionItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isParserRule(record.getElement())) {
                mergeParserRule(record,(TDQBusinessRuleItem)object.getProperty().getItem());
                isDelete=false;
              }
 else               if (isPattern(record.getElement())) {
                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);
}