Changeset 32003 in osm for applications/editors/josm/plugins/wikipedia
- Timestamp:
- 2016-01-18T14:07:47+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/wikipedia
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaApp.java
r32001 r32003 239 239 } 240 240 } 241 return null; 241 final String fallBackLabel = (String) X_PATH.compile("//label/@value").evaluate(xml, XPathConstants.STRING); 242 return fallBackLabel == null || fallBackLabel.isEmpty() ? null : fallBackLabel; 242 243 } 243 244 } catch (Exception ex) { -
applications/editors/josm/plugins/wikipedia/test/unit/org/wikipedia/WikipediaAppTest.java
r32001 r32003 157 157 assertThat(WikipediaApp.getLabelForWikidata("Q1741", Locale.GERMAN), is("Wien")); 158 158 assertThat(WikipediaApp.getLabelForWikidata("Q1741", Locale.ENGLISH), is("Vienna")); 159 // fallback to any label 160 assertThat(WikipediaApp.getLabelForWikidata("Q21849466", new Locale("aa")), is("Leoben - Straßennamen mit Geschichte")); 161 // not found -> null 159 162 assertThat(WikipediaApp.getLabelForWikidata("Q" + Long.MAX_VALUE, Locale.ENGLISH), nullValue()); 160 163 }
Note:
See TracChangeset
for help on using the changeset viewer.