Ignore:
Timestamp:
2017-12-28T00:53:58+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #15654 - repair asynchronous fetching of icons (regression from r10714) + fetch https icons asynchronously (omission from r10731)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r13186 r13250  
    631631
    632632    /**
     633     * Determines if this icon is located on a remote location (http, https, wiki).
     634     * @return {@code true} if this icon is located on a remote location (http, https, wiki)
     635     * @since 13250
     636     */
     637    public boolean isRemote() {
     638        return name.startsWith(HTTP_PROTOCOL) || name.startsWith(HTTPS_PROTOCOL) || name.startsWith(WIKI_PROTOCOL);
     639    }
     640
     641    /**
    633642     * Execute the image request and scale result.
    634643     * @return the requested image or null if the request failed
     
    655664     */
    656665    public CompletableFuture<ImageIcon> getAsync() {
    657         return name.startsWith(HTTP_PROTOCOL) || name.startsWith(WIKI_PROTOCOL)
     666        return isRemote()
    658667                ? CompletableFuture.supplyAsync(this::get, IMAGE_FETCHER)
    659668                : CompletableFuture.completedFuture(get());
     
    699708     */
    700709    public CompletableFuture<ImageResource> getResourceAsync() {
    701         return name.startsWith(HTTP_PROTOCOL) || name.startsWith(WIKI_PROTOCOL)
     710        return isRemote()
    702711                ? CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER)
    703712                : CompletableFuture.completedFuture(getResource());
Note: See TracChangeset for help on using the changeset viewer.