Ignore:
Timestamp:
2016-07-23T18:46:45+02:00 (9 years ago)
Author:
Don-vip
Message:

see #11390 - sonar - squid:S1604 - Java 8: Anonymous inner classes containing only one method should become lambdas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r8846 r10611  
    139139    private void getMOTD() {
    140140        // Asynchronously get MOTD to speed-up JOSM startup
    141         Thread t = new Thread(new Runnable() {
    142             @Override
    143             public void run() {
    144                 if (!contentInitialized && Main.pref.getBoolean("help.displaymotd", true)) {
    145                     try {
    146                         content = new MotdContent().updateIfRequiredString();
    147                         contentInitialized = true;
    148                         ProxyPreference.removeProxyPreferenceListener(GettingStarted.this);
    149                     } catch (IOException ex) {
    150                         Main.warn(tr("Failed to read MOTD. Exception was: {0}", ex.toString()));
    151                         content = "<html>" + STYLE + "<h1>" + "JOSM - " + tr("Java OpenStreetMap Editor")
    152                                 + "</h1>\n<h2 align=\"center\">(" + tr("Message of the day not available") + ")</h2></html>";
    153                         // In case of MOTD not loaded because of proxy error, listen to preference changes to retry after update
    154                         ProxyPreference.addProxyPreferenceListener(GettingStarted.this);
    155                     }
     141        Thread t = new Thread((Runnable) () -> {
     142            if (!contentInitialized && Main.pref.getBoolean("help.displaymotd", true)) {
     143                try {
     144                    content = new MotdContent().updateIfRequiredString();
     145                    contentInitialized = true;
     146                    ProxyPreference.removeProxyPreferenceListener(GettingStarted.this);
     147                } catch (IOException ex) {
     148                    Main.warn(tr("Failed to read MOTD. Exception was: {0}", ex.toString()));
     149                    content = "<html>" + STYLE + "<h1>" + "JOSM - " + tr("Java OpenStreetMap Editor")
     150                            + "</h1>\n<h2 align=\"center\">(" + tr("Message of the day not available") + ")</h2></html>";
     151                    // In case of MOTD not loaded because of proxy error, listen to preference changes to retry after update
     152                    ProxyPreference.addProxyPreferenceListener(GettingStarted.this);
    156153                }
     154            }
    157155
    158                 if (content != null) {
    159                     EventQueue.invokeLater(new Runnable() {
    160                         @Override
    161                         public void run() {
    162                             lg.setText(fixImageLinks(content));
    163                         }
    164                     });
    165                 }
     156            if (content != null) {
     157                EventQueue.invokeLater(() -> lg.setText(fixImageLinks(content)));
    166158            }
    167159        }, "MOTD-Loader");
Note: See TracChangeset for help on using the changeset viewer.