Changeset 11650 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2017-03-02T02:16:00+01:00 (7 years ago)
Author:
Don-vip
Message:

FindBugs - MS_MUTABLE_COLLECTION

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

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

    r11642 r11650  
    2121import java.util.Arrays;
    2222import java.util.Collection;
    23 import java.util.Collections;
    2423import java.util.EnumSet;
    2524import java.util.HashMap;
     
    156155
    157156    /**
    158      * Command-line arguments used to run the application.
    159      */
    160     protected static final List<String> COMMAND_LINE_ARGS = new ArrayList<>();
    161 
    162     /**
    163157     * The worker thread slave. This is for executing all long and intensive
    164158     * calculations. The executed runnables are guaranteed to be executed separately
     
    212206    public static final FileWatcher fileWatcher = new FileWatcher();
    213207
    214     protected static final Map<String, Throwable> NETWORK_ERRORS = new HashMap<>();
     208    private static final Map<String, Throwable> NETWORK_ERRORS = new HashMap<>();
    215209
    216210    private static final Set<OnlineResource> OFFLINE_RESOURCES = EnumSet.noneOf(OnlineResource.class);
     
    13841378
    13851379    /**
    1386      * Returns the command-line arguments used to run the application.
    1387      * @return the command-line arguments used to run the application
    1388      * @since 8356
    1389      */
    1390     public static List<String> getCommandLineArgs() {
    1391         return Collections.unmodifiableList(COMMAND_LINE_ARGS);
    1392     }
    1393 
    1394     /**
    13951380     * Returns the JOSM website URL.
    13961381     * @return the josm website URL
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r11093 r11650  
    1717import org.openstreetmap.josm.Main;
    1818import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;
     19import org.openstreetmap.josm.gui.MainApplication;
    1920import org.openstreetmap.josm.gui.io.SaveLayersDialog;
    2021import org.openstreetmap.josm.tools.ImageProvider;
     
    165166        }
    166167        // finally add program arguments
    167         cmd.addAll(Main.getCommandLineArgs());
     168        cmd.addAll(MainApplication.getCommandLineArgs());
    168169        return cmd;
    169170    }
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r11620 r11650  
    2929import org.openstreetmap.josm.data.preferences.Setting;
    3030import org.openstreetmap.josm.gui.ExtendedDialog;
     31import org.openstreetmap.josm.gui.MainApplication;
    3132import org.openstreetmap.josm.gui.preferences.SourceEditor;
    3233import org.openstreetmap.josm.gui.preferences.map.MapPaintPreference;
     
    166167            Main.trace(e);
    167168        }
    168         List<String> commandLineArgs = Main.getCommandLineArgs();
     169        List<String> commandLineArgs = MainApplication.getCommandLineArgs();
    169170        if (!commandLineArgs.isEmpty()) {
    170171            text.append("Program arguments: ").append(Arrays.toString(paramCleanup(commandLineArgs).toArray())).append('\n');
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r11509 r11650  
    2323import java.security.Policy;
    2424import java.security.cert.CertificateException;
     25import java.util.ArrayList;
    2526import java.util.Arrays;
    2627import java.util.Collection;
     28import java.util.Collections;
    2729import java.util.List;
    2830import java.util.Locale;
     31import java.util.Map;
    2932import java.util.Optional;
    3033import java.util.Set;
     
    8083public class MainApplication extends Main {
    8184
     85    /**
     86     * Command-line arguments used to run the application.
     87     */
     88    private static final List<String> COMMAND_LINE_ARGS = new ArrayList<>();
     89
    8290    private MainFrame mainFrame;
    8391
     
    118126        }
    119127        super.shutdown();
     128    }
     129
     130    /**
     131     * Returns the command-line arguments used to run the application.
     132     * @return the command-line arguments used to run the application
     133     * @since 11650
     134     */
     135    public static List<String> getCommandLineArgs() {
     136        return Collections.unmodifiableList(COMMAND_LINE_ARGS);
    120137    }
    121138
     
    239256        }
    240257
    241         Main.COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray));
     258        COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray));
    242259
    243260        boolean skipLoadingPlugins = args.hasOption(Option.SKIP_PLUGINS);
     
    567584
    568585        private static boolean handleNetworkErrors() {
    569             boolean condition = !NETWORK_ERRORS.isEmpty();
     586            Map<String, Throwable> networkErrors = Main.getNetworkErrors();
     587            boolean condition = !networkErrors.isEmpty();
    570588            if (condition) {
    571589                Set<String> errors = new TreeSet<>();
    572                 for (Throwable t : NETWORK_ERRORS.values()) {
     590                for (Throwable t : networkErrors.values()) {
    573591                    errors.add(t.toString());
    574592                }
     
    580598                                "It may be due to a missing proxy configuration.<br>" +
    581599                                "Would you like to change your proxy settings now?",
    582                                 Utils.joinAsHtmlUnorderedList(NETWORK_ERRORS.keySet()),
     600                                Utils.joinAsHtmlUnorderedList(networkErrors.keySet()),
    583601                                Utils.joinAsHtmlUnorderedList(errors)
    584602                        ));
Note: See TracChangeset for help on using the changeset viewer.