Skip to content

Commit

Permalink
fix up a test case to use FeatureIterator.close()
Browse files Browse the repository at this point in the history
  • Loading branch information
jodygarnett committed Oct 31, 2012
1 parent bb8bf56 commit cf3f4b9
Showing 1 changed file with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,15 @@ public void testTypes() throws IOException, NoSuchElementException {
"work already");
features = source.getFeatures(query);
features.size();
Iterator reader = features.iterator();
while (reader.hasNext()) {
SimpleFeature feature = (SimpleFeature) reader.next();
}
features.close(reader);

SimpleFeatureIterator iterator = features.features();
while (iterator.hasNext()) {
SimpleFeature feature = iterator.next();
try {
while (iterator.hasNext()) {
SimpleFeature feature = (SimpleFeature) iterator.next();
}
}
finally {
iterator.close();
}
features.close(iterator);
}
}

Expand Down Expand Up @@ -210,18 +208,11 @@ public void testSingleType() throws IOException, NoSuchElementException {
features = source.getFeatures(query);
features.size();

Iterator reader = features.iterator();
while (reader.hasNext()) {
SimpleFeature feature = (SimpleFeature) reader.next();
System.out.println(feature);
}
features.close(reader);

SimpleFeatureIterator iterator = features.features();
while (iterator.hasNext()) {
SimpleFeature feature = iterator.next();
}
features.close(iterator);
iterator.close();
}

public void XtestFeatureType() throws NoSuchElementException, IOException, SAXException {
Expand Down

0 comments on commit cf3f4b9

Please sign in to comment.