Changeset 16834 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2020-08-03T20:23:44+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Tag2Link.java
r16780 r16834 23 23 24 24 import org.openstreetmap.josm.data.osm.OsmUtils; 25 import org.openstreetmap.josm.data.preferences.ListProperty; 26 import org.openstreetmap.josm.io.CachedFile; 25 27 26 28 /** … … 54 56 .collect(Collectors.joining("|")); 55 57 58 static final ListProperty PREF_SOURCE = new ListProperty("tag2link.source", 59 Collections.singletonList("resource://META-INF/resources/webjars/tag2link/2020.7.15/index.json")); 60 56 61 private Tag2Link() { 57 62 // private constructor for utility class … … 77 82 try { 78 83 wikidataRules.clear(); 79 initializeFromResources(); 84 for (String source : PREF_SOURCE.get()) { 85 initializeFromResources(new CachedFile(source)); 86 } 80 87 } catch (Exception e) { 81 88 Logging.error("Failed to initialize tag2link rules"); … … 87 94 * Initializes the tag2link rules from the resources. 88 95 * 96 * @param resource the source 89 97 * @throws IOException in case of I/O error 90 98 */ 91 private static void initializeFromResources() throws IOException { 92 final String resource = "META-INF/resources/webjars/tag2link/2020.7.15/index.json"; 99 private static void initializeFromResources(CachedFile resource) throws IOException { 93 100 final JsonArray rules; 94 try (InputStream inputStream = Tag2Link.class.getClassLoader().getResourceAsStream(resource);101 try (InputStream inputStream = resource.getInputStream(); 95 102 JsonReader jsonReader = Json.createReader(inputStream)) { 96 103 rules = jsonReader.readArray();
Note:
See TracChangeset
for help on using the changeset viewer.