Ignore:
Timestamp:
2014-05-07T11:58:07+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #9990 - Fix session writing regression

Location:
trunk/src/org/openstreetmap/josm/io/session
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/session/GpxTracksSessionExporter.java

    r7033 r7071  
    179179    }
    180180
    181     protected void addDataFile(OutputStream out) throws IOException {
    182         try (
    183             Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
    184             GpxWriter w = new GpxWriter(new PrintWriter(writer))
    185         ) {
    186             w.write(layer.data);
    187             w.flush();
    188         }
     181    @SuppressWarnings("resource")
     182    protected void addDataFile(OutputStream out) {
     183        Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
     184        GpxWriter w = new GpxWriter(new PrintWriter(writer));
     185        w.write(layer.data);
     186        w.flush();
    189187    }
    190188}
  • trunk/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java

    r7033 r7071  
    8484    }
    8585
    86     protected void addDataFile(OutputStream out) throws IOException {
    87         try (
    88             Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
    89             MarkerWriter w = new MarkerWriter(new PrintWriter(writer))
    90         ) {
    91             w.write(layer);
    92             w.flush();
    93         }
     86    @SuppressWarnings("resource")
     87    protected void addDataFile(OutputStream out) {
     88        Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
     89        MarkerWriter w = new MarkerWriter(new PrintWriter(writer));
     90        w.write(layer);
     91        w.flush();
    9492    }
    9593
  • trunk/src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java

    r7070 r7071  
    209209    }
    210210
    211     protected void addDataFile(OutputStream out) throws IOException {
    212         try (
    213             Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
    214             OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion())
    215         ) {
    216             layer.data.getReadLock().lock();
    217             try {
    218                 w.writeLayer(layer);
    219                 w.flush();
    220             } finally {
    221                 layer.data.getReadLock().unlock();
    222             }
     211    protected void addDataFile(OutputStream out) {
     212        Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
     213        OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion());
     214        layer.data.getReadLock().lock();
     215        try {
     216            w.writeLayer(layer);
     217            w.flush();
     218        } finally {
     219            layer.data.getReadLock().unlock();
    223220        }
    224221    }
    225222}
    226 
Note: See TracChangeset for help on using the changeset viewer.