Ignore:
Timestamp:
2017-02-12T16:32:18+01:00 (7 years ago)
Author:
Don-vip
Message:

refactor handling of null values - use Java 8 Optional where possible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r10627 r11553  
    1818import java.util.Locale;
    1919import java.util.Map;
     20import java.util.Optional;
    2021import java.util.TreeMap;
    2122import java.util.jar.Attributes;
     
    199200        Attributes attr = manifest.getMainAttributes();
    200201        className = attr.getValue("Plugin-Class");
    201         String s = attr.getValue(lang+"Plugin-Link");
    202         if (s == null) {
    203             s = attr.getValue("Plugin-Link");
    204         }
     202        String s = Optional.ofNullable(attr.getValue(lang+"Plugin-Link")).orElseGet(() -> attr.getValue("Plugin-Link"));
    205203        if (s != null && !Utils.isValidUrl(s)) {
    206204            Main.info(tr("Invalid URL ''{0}'' in plugin {1}", s, name));
Note: See TracChangeset for help on using the changeset viewer.