- Timestamp:
- 2016-09-10T01:45:13+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r10962 r10983 123 123 public static void showHelp() { 124 124 // TODO: put in a platformHook for system that have no console by default 125 System.out.println(tr("Java OpenStreetMap Editor")+" [" 125 System.out.println(getHelp()); 126 } 127 128 static String getHelp() { 129 return tr("Java OpenStreetMap Editor")+" [" 126 130 +Version.getInstance().getAgentString()+"]\n\n"+ 127 131 tr("usage")+":\n"+ … … 157 161 " Java option to specify the maximum size of allocated memory in megabytes")+":\n"+ 158 162 "\t-Xmx...m\n\n"+ 159 tr("examples")+":\n"+ 160 "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+ 161 "\tjava -jar josm.jar "+OsmUrlToBounds.getURL(43.2, 11.1, 13)+'\n'+ 162 "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+ 163 "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+ 164 "\tjava -Djosm.pref=$XDG_CONFIG_HOME -Djosm.userdata=$XDG_DATA_HOME -Djosm.cache=$XDG_CACHE_HOME -jar josm.jar\n"+ 165 "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+ 166 "\tjava -Xmx1024m -jar josm.jar\n\n"+ 167 tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+'\n'+ 168 tr("Make sure you load some data if you use --selection.")+'\n' 169 ); 163 tr("examples")+":\n"+ 164 "\tjava -jar josm.jar track1.gpx track2.gpx london.osm\n"+ 165 "\tjava -jar josm.jar "+OsmUrlToBounds.getURL(43.2, 11.1, 13)+'\n'+ 166 "\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml\n"+ 167 "\tjava -jar josm.jar 43.2,11.1,43.4,11.4\n"+ 168 "\tjava -Djosm.pref=$XDG_CONFIG_HOME -Djosm.userdata=$XDG_DATA_HOME -Djosm.cache=$XDG_CACHE_HOME -jar josm.jar\n"+ 169 "\tjava -Djosm.home=/home/user/.josm_dev -jar josm.jar\n"+ 170 "\tjava -Xmx1024m -jar josm.jar\n\n"+ 171 tr("Parameters --download, --downloadgps, and --selection are processed in this order.")+'\n'+ 172 tr("Make sure you load some data if you use --selection.")+'\n'; 170 173 } 171 174 … … 182 185 args = new ProgramArguments(argArray); 183 186 } catch (IllegalArgumentException e) { 187 System.err.println(e.getMessage()); 184 188 System.exit(1); 185 189 return; … … 188 192 Level logLevel = args.getLogLevel(); 189 193 Logging.setLogLevel(logLevel); 190 Main.info(tr("Log level is at {0} ({1}, {2})", logLevel.getLocalizedName(), logLevel.getName(), logLevel.intValue())); 194 if (!args.showVersion() && !args.showHelp()) { 195 Main.info(tr("Log level is at {0} ({1}, {2})", logLevel.getLocalizedName(), logLevel.getName(), logLevel.intValue())); 196 } 191 197 192 198 Optional<String> language = args.getSingle(Option.LANGUAGE); … … 215 221 Main.platform.preStartupHook(); 216 222 217 Main.COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray));218 219 223 if (args.showVersion()) { 220 224 System.out.println(Version.getInstance().getAgentString()); 221 System.exit(0);225 return; 222 226 } else if (args.showHelp()) { 223 227 showHelp(); 224 System.exit(0); 225 } 228 return; 229 } 230 231 Main.COMMAND_LINE_ARGS.addAll(Arrays.asList(argArray)); 226 232 227 233 boolean skipLoadingPlugins = args.hasOption(Option.SKIP_PLUGINS); … … 246 252 247 253 checkIPv6(); 248 249 // asking for help? show help and exit250 if (args.hasOption(Option.HELP)) {251 showHelp();252 System.exit(0);253 }254 254 255 255 processOffline(args); -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r10748 r10983 403 403 // FIXME: This can be removed after we switch to a minimal version of Java that enables CLDR by default 404 404 // or includes all languages we need in the JRE. See http://openjdk.java.net/jeps/252 for Java 9 405 Utils.updateSystemProperty("java.locale.providers", "JRE,CLDR");405 System.setProperty("java.locale.providers", "JRE,CLDR"); // Don't call Utils.updateSystemProperty to avoid spurious log at startup 406 406 407 407 //languages.put("ar", PluralMode.MODE_AR); -
trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java
r10123 r10983 6 6 import static org.junit.Assert.assertNull; 7 7 8 import java.io.ByteArrayOutputStream; 9 import java.io.IOException; 10 import java.io.PrintStream; 8 11 import java.util.Arrays; 9 12 import java.util.Collection; … … 15 18 import org.junit.Test; 16 19 import org.openstreetmap.josm.JOSMFixture; 20 import org.openstreetmap.josm.data.Version; 17 21 import org.openstreetmap.josm.gui.SplashScreen.SplashProgressMonitor; 18 22 import org.openstreetmap.josm.plugins.PluginHandler; … … 33 37 public static void setUp() { 34 38 JOSMFixture.createUnitTestFixture().init(true); 39 } 40 41 private void testShow(final String arg, String expected) throws InterruptedException, IOException { 42 PrintStream old = System.out; 43 try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { 44 System.setOut(new PrintStream(baos)); 45 Thread t = new Thread() { 46 @Override 47 public void run() { 48 MainApplication.main(new String[] {arg}); 49 } 50 }; 51 t.run(); 52 t.join(); 53 System.out.flush(); 54 assertEquals(expected, baos.toString().trim()); 55 } finally { 56 System.setOut(old); 57 } 58 } 59 60 /** 61 * Test of {@link MainApplication#main} with argument {@code --version}. 62 * @throws Exception in case of error 63 */ 64 @Test 65 public void testShowVersion() throws Exception { 66 testShow("--version", Version.getInstance().getAgentString()); 67 } 68 69 /** 70 * Test of {@link MainApplication#main} with argument {@code --help}. 71 * @throws Exception in case of error 72 */ 73 @Test 74 public void testShowHelp() throws Exception { 75 testShow("--help", MainApplication.getHelp().trim()); 35 76 } 36 77 … … 72 113 73 114 private static PluginInformation newPluginInformation(String plugin) throws PluginListParseException { 74 //return new PluginInformation(new File(TestUtils.getTestDataRoot()+File.separator+"plugin"+File.separator+plugin+".jar"));75 115 return PluginListParser.createInfo(plugin+".jar", "https://svn.openstreetmap.org/applications/editors/josm/dist/"+plugin+".jar", 76 116 "");
Note:
See TracChangeset
for help on using the changeset viewer.