Skip to content
Browse files

not much to fix for shapefile renderer

  • Loading branch information...
1 parent e89e9a7 commit 8846925316f35cb1b863832f438ffa325fc08cae @jodygarnett jodygarnett committed Oct 30, 2012
View
57 ...orted/shapefile-renderer/src/test/java/org/geotools/renderer/shape/ShapeRendererTest.java
@@ -224,20 +224,21 @@ public void testFidFilterWithFeatureSource() throws Exception {
// Preparing the Filter
Set<FeatureId> selectedFids = new HashSet<FeatureId>();
{
- Iterator<SimpleFeature> fIt = features.iterator();
-
- int count = 0;
- while (fIt.hasNext()) {
- SimpleFeature sf = fIt.next();
-
- // Add every third to the filter
- if (count++ % 3 != 0)
- continue;
-
- selectedFids.add(sf.getIdentifier());
+ SimpleFeatureIterator fIt = features.features();
+ try {
+ int count = 0;
+ while (fIt.hasNext()) {
+ SimpleFeature sf = fIt.next();
+
+ // Add every third to the filter
+ if (count++ % 3 != 0)
+ continue;
+
+ selectedFids.add(sf.getIdentifier());
+ }
+ } finally {
+ fIt.close();
}
-
- features.close(fIt);
}
assertEquals(84, selectedFids.size());
Id filter = CommonFactoryFinder.getFilterFactory2(null).id(selectedFids);
@@ -341,9 +342,14 @@ public void testRemoveTransaction() throws Exception {
store.setTransaction(t);
SimpleFeatureCollection collection = store.getFeatures();
SimpleFeatureIterator iter = collection.features();
- FeatureId id = TestUtilites.filterFactory.featureId(iter.next().getID());
+ String fid = null;
+ try {
+ fid = iter.next().getID();
+ } finally {
+ iter.close();
+ }
+ FeatureId id = TestUtilites.filterFactory.featureId(fid);
Id createFidFilter = TestUtilites.filterFactory.id(Collections.singleton(id));
- collection.close(iter);
store.removeFeatures(createFidFilter);
MapContext context = new DefaultMapContext();
@@ -362,12 +368,18 @@ public void testRemoveTransaction() throws Exception {
collection = store.getFeatures();
iter = collection.features();
- final SimpleFeature feature = iter.next();
- collection.close(iter);
-
+ try {
+ @SuppressWarnings("unused")
+ SimpleFeature first = iter.next();
+ } finally {
+ iter.close();
+ }
+
// now add a new feature new fid should be theme2.4 remove it and assure
// that it is not rendered
+ @SuppressWarnings("unused")
SimpleFeatureType type = store.getSchema();
+
store.addFeatures(DataUtilities.collection(new SimpleFeature[] { sf } )); //$NON-NLS-1$
t.commit();
System.out.println("Count: " + ds.getFeatureSource().getCount(Query.ALL));
@@ -399,9 +411,14 @@ public void testAddTransaction() throws Exception {
store.setTransaction(t);
SimpleFeatureCollection collection = store.getFeatures();
SimpleFeatureIterator iter = collection.features();
- final SimpleFeature feature = iter.next();
- collection.close(iter);
+ try {
+ @SuppressWarnings("unused")
+ final SimpleFeature feature = iter.next();
+ } finally {
+ iter.close();
+ }
+ @SuppressWarnings("unused")
SimpleFeatureType type = ds.getSchema();
store.addFeatures(DataUtilities.collection(sf));

0 comments on commit 8846925

Please sign in to comment.
Something went wrong with that request. Please try again.