Program: 138769
Project: 138769
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());
        ModelElement element=record.getElement();
        if (element != null && element instanceof Connection) {
          Property property=record.getProperty();
          String fileName=record.getFile().getName();
          int lastIndex=fileName.lastIndexOf("String_Node_Str");
          if (lastIndex > 0) {
            fileName=fileName.substring(0,lastIndex);
          }
 else {
            fileName=new Path(fileName).removeFileExtension().lastSegment();
          }
          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);
  }
}

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();
          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);
  }
}