diff -r 7a4fd1076b15 -r 242bcad5be74 src/share/classes/com/sun/tools/doclint/DocLint.java --- a/src/share/classes/com/sun/tools/doclint/DocLint.java Mon Jun 03 16:56:54 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclint/DocLint.java Mon Jun 03 17:09:26 2013 -0700 @@ -77,13 +77,14 @@ // public static void main(String... args) { + DocLint dl = new DocLint(); try { - new DocLint().run(args); + dl.run(args); } catch (BadArgs e) { System.err.println(e.getMessage()); System.exit(1); } catch (IOException e) { - System.err.println(e); + System.err.println(dl.localize("dc.main.ioerror", e.getLocalizedMessage())); System.exit(2); } } @@ -92,9 +93,10 @@ // - public static class BadArgs extends Exception { + public class BadArgs extends Exception { private static final long serialVersionUID = 0; BadArgs(String code, Object... args) { + super(localize(code, args)); this.code = code; this.args = args; } @@ -124,7 +126,7 @@ if (javacFiles.isEmpty()) { if (!needHelp) - out.println("no files given"); + out.println(localize("dc.main.no.files.given")); } JavacTool tool = JavacTool.create(); @@ -204,49 +206,9 @@ } void showHelp(PrintWriter out) { - out.println("Usage:"); - out.println(" doclint [options] source-files..."); - out.println(""); - out.println("Options:"); - out.println(" -Xmsgs "); - out.println(" Same as -Xmsgs:all"); - out.println(" -Xmsgs:values"); - out.println(" Specify categories of issues to be checked, where 'values'"); - out.println(" is a comma-separated list of any of the following:"); - out.println(" reference show places where comments contain incorrect"); - out.println(" references to Java source code elements"); - out.println(" syntax show basic syntax errors within comments"); - out.println(" html show issues with HTML tags and attributes"); - out.println(" accessibility show issues for accessibility"); - out.println(" missing show issues with missing documentation"); - out.println(" all all of the above"); - out.println(" Precede a value with '-' to negate it"); - out.println(" Categories may be qualified by one of:"); - out.println(" /public /protected /package /private"); - out.println(" For positive categories (not beginning with '-')"); - out.println(" the qualifier applies to that access level and above."); - out.println(" For negative categories (beginning with '-')"); - out.println(" the qualifier applies to that access level and below."); - out.println(" If a qualifier is missing, the category applies to"); - out.println(" all access levels."); - out.println(" For example, -Xmsgs:all,-syntax/private"); - out.println(" This will enable all messages, except syntax errors"); - out.println(" in the doc comments of private methods."); - out.println(" If no -Xmsgs options are provided, the default is"); - out.println(" equivalent to -Xmsgs:all/protected, meaning that"); - out.println(" all messages are reported for protected and public"); - out.println(" declarations only. "); - out.println(" -stats"); - out.println(" Report statistics on the reported issues."); - out.println(" -h -help --help -usage -?"); - out.println(" Show this message."); - out.println(""); - out.println("The following javac options are also supported"); - out.println(" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"); - out.println(""); - out.println("To run doclint on part of a project, put the compiled classes for your"); - out.println("project on the classpath (or bootclasspath), then specify the source files"); - out.println("to be checked on the command line."); + String msg = localize("dc.main.usage"); + for (String line: msg.split("\n")) + out.println(line); } List splitPath(String path) { @@ -353,6 +315,11 @@ return false; } + private String localize(String code, Object... args) { + Messages m = (env != null) ? env.messages : new Messages(null); + return m.localize(code, args); + } + // static abstract class DeclScanner extends TreePathScanner {