Ignore:
Timestamp:
2017-09-15T01:20:41+02:00 (7 years ago)
Author:
Don-vip
Message:

see #11390 - SonarQube - squid:S3824 - "Map.get" and value test should be replaced with single method call

Location:
trunk/src/org/openstreetmap/josm/data/cache
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/cache/CacheEntryAttributes.java

    r12620 r12865  
    8989     */
    9090    private long getLongAttr(String key) {
    91         String val = attrs.get(key);
    92         if (val == null) {
    93             attrs.put(key, "0");
    94             return 0;
    95         }
    9691        try {
    97             return Long.parseLong(val);
     92            return Long.parseLong(attrs.computeIfAbsent(key, k -> "0"));
    9893        } catch (NumberFormatException e) {
    9994            attrs.put(key, "0");
  • trunk/src/org/openstreetmap/josm/data/cache/HostLimitQueue.java

    r12620 r12865  
    159159        if (limit == null) {
    160160            synchronized (hostSemaphores) {
    161                 limit = hostSemaphores.get(host);
    162                 if (limit == null) {
    163                     limit = new Semaphore(hostLimit);
    164                     hostSemaphores.put(host, limit);
    165                 }
     161                limit = hostSemaphores.computeIfAbsent(host, k -> new Semaphore(hostLimit));
    166162            }
    167163        }
Note: See TracChangeset for help on using the changeset viewer.