Ignore:
Timestamp:
2017-06-07T14:51:46+02:00 (7 years ago)
Author:
donvip
Message:

use try-with-resources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/geographic/ShpReader.java

    r32545 r33378  
    214214                FeatureSource<?, ?> featureSource = dataStore.getFeatureSource(typeName);
    215215                FeatureCollection<?, ?> collection = featureSource.getFeatures();
    216                 FeatureIterator<?> iterator = collection.features();
    217216
    218217                if (instance != null) {
     
    224223                Component parent = instance != null ? instance.getWindowParent() : Main.parent;
    225224
    226                 try {
     225                try (FeatureIterator<?> iterator = collection.features()) {
    227226                    while (iterator.hasNext()) {
    228227                        n++;
     
    243242                    }
    244243                } finally {
    245                     iterator.close();
    246244                    nodes.clear();
    247245                    if (instance != null) {
     
    251249            }
    252250        } catch (IOException e) {
    253             e.printStackTrace();
     251            Main.error(e);
    254252            throw e;
    255253        } catch (Exception e) {
    256             e.printStackTrace();
     254            Main.error(e);
    257255            throw new IOException(e);
    258256        }
Note: See TracChangeset for help on using the changeset viewer.