Hi all,
i'm currently testing with a shapefile that contains some invalid attribute values. For example, it contains the value '200a' for a year attribute. When reading this value:
final FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = dataStore.getFeatureSource(typeName);
featureCollection = featureSource.getFeatures();
// iterate through all features of the feature collection
featureCollectionIterator = featureCollection.features();
while (featureCollectionIterator.hasNext()) {
try {
SimpleFeature simpleFeature = featureCollectionIterator.next();
Object year = simpleFeature.getAttribute(getAttributeName("year"));
LOGGER.debug(year);
//...
This code snippet will produce an output '0' for the year attribute. My question is; how can i generate an exception when a value in the shapefile is invalid? Or how can i retrieve the original value, so i can compare it myself, and generate the exception manually?