Program: 138825
Project: 138825
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);
            ElementWriterFactory.getInstance().create(element).create(element,folder);
          }
        }
      }
 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());
        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);
  }
}