Changeset 14536 in josm for trunk/test
- Timestamp:
- 2018-12-09T20:45:03+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java
r14535 r14536 10 10 import java.util.ArrayList; 11 11 import java.util.Collections; 12 import java.util.HashSet;13 12 import java.util.List; 14 13 import java.util.Map; 15 import java.util.Set;16 14 import java.util.TreeMap; 17 15 import java.util.concurrent.TimeUnit; … … 69 67 70 68 private final Map<String, Map<ImageryInfo, List<String>>> errors = Collections.synchronizedMap(new TreeMap<>()); 71 private final Set<String> workingURLs = Collections.synchronizedSet(new HashSet<>());69 private final Map<String, byte[]> workingURLs = Collections.synchronizedMap(new TreeMap<>()); 72 70 73 71 private TMSCachedTileLoaderJob helper; … … 92 90 93 91 private byte[] checkUrl(ImageryInfo info, String url) { 94 if (url != null && !url.isEmpty() && !workingURLs.contains(url)) { 92 if (url != null && !url.isEmpty()) { 93 if (workingURLs.containsKey(url)) { 94 return workingURLs.get(url); 95 } 95 96 try { 96 97 Response response = HttpClient.create(new URL(url)) … … 103 104 } else if (response.getResponseCode() >= 300) { 104 105 Logging.warn(url + " -> HTTP " + response.getResponseCode()); 105 } else {106 workingURLs.add(url);107 106 } 108 107 try { 109 return Utils.readBytesFromStream(response.getContent()); 108 byte[] data = Utils.readBytesFromStream(response.getContent()); 109 if (response.getResponseCode() < 300) { 110 workingURLs.put(url, data); 111 } 112 return data; 110 113 } finally { 111 114 response.disconnect();
Note:
See TracChangeset
for help on using the changeset viewer.