Program: 52911
Project: 52911
Buggy source:
/** 
 * Will attempt to spatiotag left ot right with attributes. Need to write up this documentation.
 */
private void parseShapefile(LayerStruct struct) throws WikiBrainException {
  ShapefileReader shpReader;
  DbaseFileReader dbfReader;
  Geometry curGeometry;
  ShpFiles shpFile;
  LOG.log(Level.INFO,"String_Node_Str" + struct.getDataFile().getName());
  try {
    shpFile=new ShpFiles(struct.getDataFile().getAbsolutePath());
    shpReader=new ShapefileReader(shpFile,true,true,new GeometryFactory(new PrecisionModel(),4326));
    dbfReader=new DbaseFileReader(shpFile,false,Charset.forName("String_Node_Str"));
    int numDbfFields=dbfReader.getHeader().getNumFields();
    List<IDAttributeHandler> attrHandlers=Lists.newArrayList();
    for (int i=0; i < numDbfFields; i++) {
      attrHandlers.add(IDAttributeHandler.getHandlerByFieldName(dbfReader.getHeader().getFieldName(i),wdDao,analyzer));
    }
    int foundGeomCount=0;
    int missedGeomCount=0;
    while (shpReader.hasNext()) {
      curGeometry=(Geometry)shpReader.nextRecord().shape();
      dbfReader.read();
      int i=0;
      boolean found=false;
      while (i < numDbfFields && !found) {
        IDAttributeHandler attrHandler=attrHandlers.get(i);
        Integer itemId=attrHandler.getWikidataItemIdForId(dbfReader.readField(i));
        if (itemId != null && spatialDataDao.getGeometry(itemId,struct.getLayerName(),struct.getRefSysName()) == null) {
          spatialDataDao.saveGeometry(itemId,struct.getLayerName(),struct.getRefSysName(),curGeometry);
          found=true;
          foundGeomCount++;
          if (foundGeomCount % 10 == 0) {
            LOG.log(Level.INFO,"String_Node_Str" + foundGeomCount + "String_Node_Str"+ struct.getLayerName()+ "String_Node_Str"+ struct.getRefSysName()+ "String_Node_Str");
          }
        }
        i++;
      }
      if (!found)       missedGeomCount++;
    }
    double matchRate=((double)foundGeomCount) / (foundGeomCount + missedGeomCount);
    LOG.log(Level.INFO,"String_Node_Str" + struct.getLayerName() + "String_Node_Str"+ matchRate);
    dbfReader.close();
    shpReader.close();
  }
 catch (  ShapefileException e) {
    throw new WikiBrainException("String_Node_Str",e);
  }
catch (  IOException e) {
    throw new WikiBrainException("String_Node_Str",e);
  }
catch (  DaoException e) {
    throw new WikiBrainException(e);
  }
}

Fixed version (ground truth):
/** 
 * Will attempt to spatiotag left ot right with attributes. Need to write up this documentation.
 */
private void parseShapefile(LayerStruct struct) throws WikiBrainException {
  ShapefileReader shpReader;
  DbaseFileReader dbfReader;
  Geometry curGeometry;
  ShpFiles shpFile;
  LOG.log(Level.INFO,"String_Node_Str" + struct.getDataFile().getName());
  try {
    shpFile=new ShpFiles(struct.getDataFile().getAbsolutePath());
    shpReader=new ShapefileReader(shpFile,true,true,new GeometryFactory(new PrecisionModel(),4326));
    dbfReader=new DbaseFileReader(shpFile,false,Charset.forName("String_Node_Str"));
    int numDbfFields=dbfReader.getHeader().getNumFields();
    List<IDAttributeHandler> attrHandlers=Lists.newArrayList();
    for (int i=0; i < numDbfFields; i++) {
      attrHandlers.add(IDAttributeHandler.getHandlerByFieldName(dbfReader.getHeader().getFieldName(i),wdDao,analyzer));
    }
    int foundGeomCount=0;
    int missedGeomCount=0;
    while (shpReader.hasNext()) {
      curGeometry=(Geometry)shpReader.nextRecord().shape();
      dbfReader.read();
      int i=0;
      boolean found=false;
      while (i < numDbfFields && !found) {
        IDAttributeHandler attrHandler=attrHandlers.get(i);
        Integer itemId;
        try {
          itemId=attrHandler.getWikidataItemIdForId(dbfReader.readField(i));
        }
 catch (        Exception e) {
          i++;
          continue;
        }
        if (itemId != null && spatialDataDao.getGeometry(itemId,struct.getLayerName(),struct.getRefSysName()) == null) {
          spatialDataDao.saveGeometry(itemId,struct.getLayerName(),struct.getRefSysName(),curGeometry);
          found=true;
          foundGeomCount++;
          if (foundGeomCount % 10 == 0) {
            LOG.log(Level.INFO,"String_Node_Str" + foundGeomCount + "String_Node_Str"+ struct.getLayerName()+ "String_Node_Str"+ struct.getRefSysName()+ "String_Node_Str");
          }
        }
        i++;
      }
      if (!found)       missedGeomCount++;
    }
    double matchRate=((double)foundGeomCount) / (foundGeomCount + missedGeomCount);
    LOG.log(Level.INFO,"String_Node_Str" + struct.getLayerName() + "String_Node_Str"+ matchRate);
    dbfReader.close();
    shpReader.close();
  }
 catch (  ShapefileException e) {
    throw new WikiBrainException("String_Node_Str",e);
  }
catch (  IOException e) {
    throw new WikiBrainException("String_Node_Str",e);
  }
catch (  DaoException e) {
    throw new WikiBrainException(e);
  }
}