Changeset 8356 in josm


Ignore:
Timestamp:
2015-05-15T22:50:00+02:00 (4 years ago)
Author:
Don-vip
Message:

remove public mutable array Main.commandLineArgs

Location:
trunk
Files:
5 edited

Legend:

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

    r8345 r8356  
    160160     * Command-line arguments used to run the application.
    161161     */
    162     public static String[] commandLineArgs;
     162    protected static final List<String> COMMAND_LINE_ARGS = new ArrayList<>();
    163163
    164164    /**
     
    16451645
    16461646    /**
     1647     * Returns the command-line arguments used to run the application.
     1648     * @return the command-line arguments used to run the application
     1649     * @since 8356
     1650     */
     1651    public static List<String> getCommandLineArgs() {
     1652        return Collections.unmodifiableList(COMMAND_LINE_ARGS);
     1653    }
     1654
     1655    /**
    16471656     * Returns the JOSM website URL.
    16481657     * @return the josm website URL
  • trunk/src/org/openstreetmap/josm/actions/RestartAction.java

    r7937 r8356  
    1111import java.lang.management.ManagementFactory;
    1212import java.util.ArrayList;
    13 import java.util.Arrays;
    1413import java.util.List;
    1514
     
    137136                }
    138137                // finally add program arguments
    139                 cmd.addAll(Arrays.asList(Main.commandLineArgs));
     138                cmd.addAll(Main.getCommandLineArgs());
    140139            }
    141140            Main.info("Restart "+cmd);
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r8061 r8356  
    132132            // Ignore exception
    133133        }
    134         if (Main.commandLineArgs.length > 0) {
    135             text.append("Program arguments: "+ Arrays.toString(Main.commandLineArgs));
     134        List<String> commandLineArgs = Main.getCommandLineArgs();
     135        if (!commandLineArgs.isEmpty()) {
     136            text.append("Program arguments: "+ Arrays.toString(commandLineArgs.toArray()));
    136137            text.append("\n");
    137138        }
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r8298 r8356  
    1616import java.io.InputStream;
    1717import java.net.Authenticator;
     18import java.net.Inet6Address;
    1819import java.net.InetAddress;
    19 import java.net.Inet6Address;
    2020import java.net.ProxySelector;
    2121import java.net.URL;
     
    202202        ;
    203203
    204         private String name;
    205         private boolean requiresArgument;
     204        private final String name;
     205        private final boolean requiresArg;
    206206
    207207        private Option(boolean requiresArgument) {
    208208            this.name = name().toLowerCase().replace("_", "-");
    209             this.requiresArgument = requiresArgument;
     209            this.requiresArg = requiresArgument;
    210210        }
    211211
     
    223223         */
    224224        public boolean requiresArgument() {
    225             return requiresArgument;
     225            return requiresArg;
    226226        }
    227227
     
    336336        Main.platform.preStartupHook();
    337337
    338         Main.commandLineArgs = Utils.copyArray(argArray);
     338        Main.COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray));
    339339
    340340        if (args.containsKey(Option.VERSION)) {
     
    569569        }
    570570    }
    571    
     571
    572572    private static class GuiFinalizationWorker implements Runnable {
    573573
  • trunk/test/unit/org/openstreetmap/josm/tools/BugReportExceptionHandlerTest.java

    r7937 r8356  
    2828    @Before
    2929    public void setUp() {
    30         Main.commandLineArgs = new String[0];
    3130        JOSMFixture.createUnitTestFixture().init();
    3231    }
Note: See TracChangeset for help on using the changeset viewer.