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?
-- 
View this message in context: 
http://n2.nabble.com/Skip-the-evaluation-of-feature-attributes-tp3602083p3602083.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to