Ignore:
Timestamp:
2014-10-19T01:27:04+02:00 (10 years ago)
Author:
donvip
Message:

[josm_plugins] fix java 7 warnings / global usage of try-with-resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaApp.java

    r30737 r30738  
    2525import javax.xml.xpath.XPathFactory;
    2626
     27import org.openstreetmap.josm.Main;
    2728import org.openstreetmap.josm.data.coor.LatLon;
    2829import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    116117                connection.setDoOutput(true);
    117118
    118                 OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8");
    119                 out.write("articles=" + encodeURL(Utils.join(",", articleNames)));
    120                 out.close();
    121 
     119                try (OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8")) {
     120                        out.write("articles=" + encodeURL(Utils.join(",", articleNames)));
     121                }
    122122
    123123                final Scanner scanner = new Scanner(connection.getInputStream(), "UTF-8").useDelimiter("\n");
     
    129129                        status.put(x[0], "1".equals(x[1]));
    130130                    } else {
    131                         System.err.println("Unknown element " + line);
     131                        Main.error("Unknown element " + line);
    132132                    }
    133133                }
Note: See TracChangeset for help on using the changeset viewer.