Changeset 14506 in josm


Ignore:
Timestamp:
2018-12-03T23:15:52+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #17068 - synchronize inner classloader set of ImageProvider

File:
1 edited

Legend:

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

    r14439 r14506  
    3535import java.util.Base64;
    3636import java.util.Collection;
     37import java.util.Collections;
    3738import java.util.EnumMap;
    3839import java.util.HashMap;
     
    259260
    260261    /** set of class loaders to take images from */
    261     private static final Set<ClassLoader> classLoaders = new HashSet<>();
     262    private static final Set<ClassLoader> classLoaders = Collections.synchronizedSet(new HashSet<>());
    262263    static {
    263264        try {
     
    12081209        if (path != null && path.startsWith("resource://")) {
    12091210            String p = path.substring("resource://".length());
    1210             for (ClassLoader source : classLoaders) {
    1211                 URL res;
    1212                 if ((res = source.getResource(p + name)) != null)
    1213                     return res;
     1211            synchronized (classLoaders) {
     1212                for (ClassLoader source : classLoaders) {
     1213                    URL res;
     1214                    if ((res = source.getResource(p + name)) != null)
     1215                        return res;
     1216                }
    12141217            }
    12151218        } else {
Note: See TracChangeset for help on using the changeset viewer.