Index: applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java
===================================================================
--- applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java	(revision 30737)
+++ applications/editors/josm/plugins/walkingpapers/src/org/openstreetmap/josm/plugins/walkingpapers/WalkingPapersAddLayerAction.java	(revision 30738)
@@ -25,5 +25,6 @@
     }
 
-    public void actionPerformed(ActionEvent e) {
+    @Override
+	public void actionPerformed(ActionEvent e) {
         String wpid = JOptionPane.showInputDialog(Main.parent,
             tr("Enter a walking-papers.org URL or ID (the bit after the ?id= in the URL)"),
@@ -51,6 +52,5 @@
         String tile = null;
 
-        try {
-            BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"));
+        try (BufferedReader r = new BufferedReader(new InputStreamReader(new URL(wpUrl).openStream(), "utf-8"))) {
             for (String line = r.readLine(); line != null; line = r.readLine()) {
                 m = spanPattern.matcher(line);
@@ -65,6 +65,7 @@
                 }
             }
-            r.close();
-            if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) throw new Exception();
+            if ((tile == null) || (north == 0 && south == 0) || (east == 0 && west == 0)) {
+            	throw new IllegalStateException();
+            }
         } catch (Exception ex) {
             JOptionPane.showMessageDialog(Main.parent,tr("Could not read information from walking-papers.org the id \"{0}\"", mungedWpId));
