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/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java

    r29854 r30738  
    2525    }
    2626
    27     public void actionPerformed(ActionEvent e) {
     27    @Override
     28        public void actionPerformed(ActionEvent e) {
    2829        String wpid = JOptionPane.showInputDialog(Main.parent,
    2930            tr("Enter a walking-papers.org URL or ID (the bit after the ?id= in the URL)"),
     
    5152        String tile = null;
    5253
    53         try {
    54             BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"));
     54        try (BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"))) {
    5555            for (String line = r.readLine(); line != null; line = r.readLine()) {
    5656                m = spanPattern.matcher(line);
     
    6565                }
    6666            }
    67             r.close();
    68             if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) throw new Exception();
     67            if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) {
     68                throw new IllegalStateException();
     69            }
    6970        } catch (Exception ex) {
    7071            JOptionPane.showMessageDialog(Main.parent,tr("Could not read information from walking-papers.org the id \"{0}\"", mungedWpId));
Note: See TracChangeset for help on using the changeset viewer.