Program: 138814
Project: 138814
Buggy source:
public void write(ItemRecord[] records,IProgressMonitor monitor){
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  try {
    for (    ItemRecord record : records) {
      if (monitor.isCanceled()) {
        break;
      }
      Map<IPath,IPath> toImportMap=mapping(record);
      monitor.subTask("String_Node_Str" + record.getName());
      if (record.isValid()) {
        log.info("String_Node_Str" + record.getFile().getAbsolutePath());
        if (record.getElement() != null) {
          ModelElement element=record.getElement();
          Property property=record.getProperty();
          EResourceConstant typedConstant=EResourceConstant.getTypedConstant(element);
          if (typedConstant != null) {
            IPath folderPath=new Path(typedConstant.getPath());
            ItemState state=property.getItem().getState();
            if (state != null && state.getPath() != null) {
              folderPath.append(state.getPath());
            }
            IFolder folder=ResourceManager.getRootProject().getFolder(folderPath);
            AElementPersistance creator=ElementWriterFactory.getInstance().create(element);
            if (creator != null) {
              creator.create(element,folder);
            }
 else {
              log.error("String_Node_Str" + element.getName());
            }
          }
        }
      }
 else {
        for (        String error : record.getErrors()) {
          log.error(error);
        }
      }
      monitor.worked(1);
    }
    if (commonTasks != null) {
      MigrationTaskManager.doMigrationTask(commonTasks,monitor);
    }
    finish(records,monitor);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}

Fixed version (ground truth):
public void write(ItemRecord[] records,IProgressMonitor monitor){
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  try {
    for (    ItemRecord record : records) {
      if (monitor.isCanceled()) {
        break;
      }
      Map<IPath,IPath> toImportMap=mapping(record);
      monitor.subTask("String_Node_Str" + record.getName());
      if (record.isValid()) {
        log.info("String_Node_Str" + record.getFile().getAbsolutePath());
        ModelElement element=record.getElement();
        if (element != null && element instanceof Connection) {
          Property property=record.getProperty();
          String fileName=record.getFile().getName();
          fileName=fileName.substring(0,fileName.lastIndexOf("String_Node_Str"));
          property.setLabel(fileName);
          IPath statePath;
          ItemState state=property.getItem().getState();
          if (state != null && state.getPath() != null) {
            statePath=new Path(state.getPath());
          }
 else {
            statePath=Path.EMPTY;
          }
          ProxyRepositoryFactory.getInstance().create(property.getItem(),statePath);
        }
 else {
          for (          IPath resPath : toImportMap.keySet()) {
            IPath desPath=toImportMap.get(resPath);
            write(resPath,desPath);
          }
        }
      }
 else {
        for (        String error : record.getErrors()) {
          log.error(error);
        }
      }
      monitor.worked(1);
    }
    finish(records,monitor);
  }
 catch (  Exception e) {
    log.error(e,e);
  }
}