Issue Type: Improvement Improvement
Affects Versions: 8.0-RC3
Assignee: Jody Garnett
Components: api
Created: 03/Jul/12 5:09 AM
Description:

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:

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

FeatureIterator iterator = featureSource.getFeatures();
try {
     while( iterator.hasNext() ){
           Feature f = iterator.next();
           System.out.println( f.getIdentifier() );
     }    
}
finally {
    if( iterator != null ) iteator.close();
}
// IOException can be thrown from the above
Project: GeoTools
Priority: Minor Minor
Reporter: Jody Garnett
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
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

Reply via email to