On Mon, Jul 2, 2012 at 4:23 AM, Jody Garnett <jody.garn...@gmail.com> wrote:
> I mentioned this a couple weeks ago; but after reading into the Java 7
> pipeline and Juno support for try-with-resource I am even more convinced
> that this is a necissary change for GeoTools 9.x.
>
> Reading:
> -
> http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
> -
> http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2FwhatsNew%2FJava7news%2Fwhats-new-java-7.html
>
> I will prepare a change request; it amounts to:
>
> interface FeatureIterator< F extends Feature> implements Closable {
> public void close() throws IOException;
> }
>
> It allows the following:
>
> Java 7: try-with-resource
>
> try (FeatureIterator iterator = feastureSource.getFeatures()){
> while( iterator.hasNext() ){
> Feature f = iterator.next();
> System.out.println( f.getIdentifier() );
> }
> }
> This would finally let us recover for the darn for-each loop.
> FeatureReader and FeatureWriter should also implement closable.
>
> Java 6: close() would throw IOException
>
Looks good to me. As said in the past, imho it has been a mistake not to
throw IOException from
the other FeatureIterator methods (they can do IO after all), but adding it
now might require heavy
code migrations...
Cheers
Andrea
--
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel