428 } |
428 } |
429 } |
429 } |
430 } catch (BadArgs e) { |
430 } catch (BadArgs e) { |
431 reportError(e.key, e.args); |
431 reportError(e.key, e.args); |
432 if (e.showUsage) { |
432 if (e.showUsage) { |
433 log.println(getMessage("main.usage.summary", progname)); |
433 printLines(getMessage("main.usage.summary", progname)); |
434 } |
434 } |
435 return EXIT_CMDERR; |
435 return EXIT_CMDERR; |
436 } catch (InternalError e) { |
436 } catch (InternalError e) { |
437 Object[] e_args; |
437 Object[] e_args; |
438 if (e.getCause() == null) |
438 if (e.getCause() == null) |
837 fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS); |
837 fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS); |
838 return fo; |
838 return fo; |
839 } |
839 } |
840 |
840 |
841 private void showHelp() { |
841 private void showHelp() { |
842 log.println(getMessage("main.usage", progname)); |
842 printLines(getMessage("main.usage", progname)); |
843 for (Option o: recognizedOptions) { |
843 for (Option o: recognizedOptions) { |
844 String name = o.aliases[0].substring(1); // there must always be at least one name |
844 String name = o.aliases[0].substring(1); // there must always be at least one name |
845 if (name.startsWith("X") || name.equals("fullversion") || name.equals("h") || name.equals("verify")) |
845 if (name.startsWith("X") || name.equals("fullversion") || name.equals("h") || name.equals("verify")) |
846 continue; |
846 continue; |
847 log.println(getMessage("main.opt." + name)); |
847 printLines(getMessage("main.opt." + name)); |
848 } |
848 } |
849 String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" }; |
849 String[] fmOptions = { "-classpath", "-cp", "-bootclasspath" }; |
850 for (String o: fmOptions) { |
850 for (String o: fmOptions) { |
851 if (fileManager.isSupportedOption(o) == -1) |
851 if (fileManager.isSupportedOption(o) == -1) |
852 continue; |
852 continue; |
853 String name = o.substring(1); |
853 String name = o.substring(1); |
854 log.println(getMessage("main.opt." + name)); |
854 printLines(getMessage("main.opt." + name)); |
855 } |
855 } |
856 |
856 |
857 } |
857 } |
858 |
858 |
859 private void showVersion(boolean full) { |
859 private void showVersion(boolean full) { |
860 log.println(version(full ? "full" : "release")); |
860 printLines(version(full ? "full" : "release")); |
861 } |
861 } |
|
862 |
|
863 private void printLines(String msg) { |
|
864 log.println(msg.replace("\n", nl)); |
|
865 } |
|
866 |
|
867 private static final String nl = System.getProperty("line.separator"); |
862 |
868 |
863 private static final String versionRBName = "com.sun.tools.javap.resources.version"; |
869 private static final String versionRBName = "com.sun.tools.javap.resources.version"; |
864 private static ResourceBundle versionRB; |
870 private static ResourceBundle versionRB; |
865 |
871 |
866 private String version(String key) { |
872 private String version(String key) { |