We've had reports of shapefiles not being completely imported into our system (no error message but more than 50% of the features missing). Notably, QGis handles these files fine. I've attached some test data and created a small test case. It shows that the FeatureCollection returned does contain the correct number of features, except that many of them are null values! This is the output I'm getting:
Found 2272 features.
Iterated through 418 features using FeatureIterator.
Iterated through 2272 features using Array. Found 1854 nulls.
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.64 sec <<< FAILURE!
testShapeIO(org.geotools.testcase.TestShapeIO): Nulls found!
We were using the FeatureIterator and didn't even notice that features we're missing until we had it reported to us.
The test case should be runnable by typing:
$ mvn test
Any idea what's going on? Like I said QGis seems to handle the data fine. The test case has some code commented out for exporting whatever geotools reads from the shapefile. Opening this export alongside the shapefile import.shp in QGis clearly illustrates the missing features.