Changeset 28472 in osm for applications/editors/josm/plugins/wikipedia/src
- Timestamp:
- 2012-07-11T22:35:45+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaToggleDialog.java
r28470 r28472 229 229 articleNames.add(i.wikipediaArticle); 230 230 } 231 final String url = "https://toolserver.org/~simon04/getGeoJSONStatus.php"232 + "?lang=" + wikipediaLang.get()233 + "&articles=" + encodeURL(Utils.join(",", articleNames));234 System.out.println("Wikipedia: GET " + url);235 231 Map<String, Boolean> status = new HashMap<String, Boolean>(); 236 237 try { 238 final Scanner scanner = new Scanner(new URL(url).openStream()).useDelimiter("\n"); 239 while (scanner.hasNext()) { 240 //[article]\t[0|1] 241 final String line = scanner.next(); 242 final String[] x = line.split("\t"); 243 if (x.length == 2) { 244 status.put(x[0], "1".equals(x[1])); 245 } else { 246 System.err.println("Unknown element "+line); 247 } 248 } 249 } catch (Exception ex) { 250 throw new RuntimeException(ex); 232 if (!articleNames.isEmpty()) { 233 final String url = "https://toolserver.org/~simon04/getGeoJSONStatus.php" 234 + "?lang=" + wikipediaLang.get() 235 + "&articles=" + encodeURL(Utils.join(",", articleNames)); 236 System.out.println("Wikipedia: GET " + url); 237 238 try { 239 final Scanner scanner = new Scanner(new URL(url).openStream()).useDelimiter("\n"); 240 while (scanner.hasNext()) { 241 //[article]\t[0|1] 242 final String line = scanner.next(); 243 final String[] x = line.split("\t"); 244 if (x.length == 2) { 245 status.put(x[0], "1".equals(x[1])); 246 } else { 247 System.err.println("Unknown element " + line); 248 } 249 } 250 } catch (Exception ex) { 251 throw new RuntimeException(ex); 252 } 251 253 } 252 254
Note:
See TracChangeset
for help on using the changeset viewer.