>> Around in circles we go :-P
>> FeatureReader is like an iterator that throws IOExceptions ... and users 
>> hated it.
> 
> Who besides James hated it? ;-)

Not sure I was too shy at the time; I do remember hating explaining it to 
people repeatedly.
> 
>> SimpleFeatureReader reader = null;
>> try {
>>     reader = dataStore.getFeatureReader( typeName, filter, 
>> Transaction.AUTO_COMMIT );
>>     while( reader.hasNext() ){
>>          try {
>>              SimpleFeature feature = reader.next();
>>          }
>>          catch( IllegalArgumentException badData ){
>>              // skipping this feature since it has invalid data
>>          }
>>          catch( IOException unexpected ){
>>              unexpected.printStackTrace();
>>              break; // after an IOException the reader is "broken"
>>          }
> 
> Sorry, this looks retarded to me. How much code has to be so permissive to 
> skip over bad data? One try/catch is enough.

In my experience a lot of it - but I guess it really depends on the quality of 
your data. When doing data work at refractions we usually found 10-20% to 
require cleaning. The more information we put into AttributeDescriptor the 
greater the chance an individual feature has of failing.

One thing we can do is make any validation exceptions into an IOException of 
some sort? That would at least leave one exception to catch.
>> Thinking...
>> Given the amount of code that would break we would either need to 
>> reintroduce feature reader; or update featureiterator and call the result 
>> GeoTools 3.0 - as all feature reading code would be broken....
>> Here is another idea -  would declaring a runtime exception as part of the 
>> method work? It would be honest about the possibility for error; and not 
>> break existing code - and for GeoTools3 we could make it a checked exception.
> 
> I guess it would be somewhat better. At least the small percentage
> of users that does read the documentation would know exceptions
> can happen...

And what about the idea of making it an Exception for GeoTools 3? Does it hold 
any interest to you?

Jody
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to