What to do when getting “java.io.IOException: Dbf has extra record” while using GeoTools?

I’m new to GeoTools and have been trying to implement a method that looks for a CBSA Code in a Shape File based on a Longitude/Latitude pair. I have already been able to read the ShapeFile and to put it into a FileDataStore. At the beginning I tried implementing a filter that looked for the point with the following implementation:

    public MSA getCbsaWithLatLong(Double longitude, Double latitude) throws IOException {
    File file = null;

    file = new File("src/main/resources/cb_2016_us_cbsa_500k.shp");
    filterFactory = CommonFactoryFinder.getFilterFactory2(GeoTools
    FileDataStore store = FileDataStoreFinder.getDataStore(file);
    SimpleFeatureSource featureSource = store.getFeatureSource();
    SimpleFeatureCollection features = featureSource.getFeatures();
    env = features.getBounds();
    GeometryFactory fac = new GeometryFactory();
    Point p = fac.createPoint(new Coordinate(longitude, latitude));

    Long cbsaCode = getCbsaCode(p, CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints()),
      features, features.getBounds());
    return cbsaCode != null ? msaRepository.findAllByCBSACode(cbsaCode).get(0) : msaRepository.findOne(1L);

  private Long getCbsaCode(Point p, FilterFactory2 filterFactory,
                           SimpleFeatureCollection features, ReferencedEnvelope env) {
    if (!env.contains(p.getCoordinate())) {
      return null;
    Expression propertyName = filterFactory.property(features.getSchema()
    Filter filter = filterFactory.contains(propertyName,
    SimpleFeatureCollection sub = features.subCollection(filter);
    return  sub.features().hasNext() ? Long.parseLong(sub.features().next().getAttribute("CBSAFP").toString()) : null;

This only seemed to work for a few of the cases that should work. Therefore I decided to go through all the features using the SimpleFeatureIterator with the following implementation and validating whether the point was included in the bounds at each iteration:

try {
  SimpleFeature feature;
  while( iterator.hasNext() ){
    feature = iterator.next();
    if (feature.getBounds().contains(longitude, latitude)) {
      return msaRepository.findAllByCBSACode(Long.parseLong(feature.getAttribute(2).toString())).get(0);
} catch (Exception e) {
} finally {

This works fine until it fails at a specific iteration when calling the .hasNext() method throwing the following exception: java.io.IOException: Dbf has extra record

Does anyone know how this can be solved?

Thank you!