1.1 --- a/src/share/classes/com/sun/tools/doclint/DocLint.java Mon Jun 03 16:56:54 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclint/DocLint.java Mon Jun 03 17:09:26 2013 -0700 1.3 @@ -77,13 +77,14 @@ 1.4 1.5 // <editor-fold defaultstate="collapsed" desc="Command-line entry point"> 1.6 public static void main(String... args) { 1.7 + DocLint dl = new DocLint(); 1.8 try { 1.9 - new DocLint().run(args); 1.10 + dl.run(args); 1.11 } catch (BadArgs e) { 1.12 System.err.println(e.getMessage()); 1.13 System.exit(1); 1.14 } catch (IOException e) { 1.15 - System.err.println(e); 1.16 + System.err.println(dl.localize("dc.main.ioerror", e.getLocalizedMessage())); 1.17 System.exit(2); 1.18 } 1.19 } 1.20 @@ -92,9 +93,10 @@ 1.21 1.22 // <editor-fold defaultstate="collapsed" desc="Simple API"> 1.23 1.24 - public static class BadArgs extends Exception { 1.25 + public class BadArgs extends Exception { 1.26 private static final long serialVersionUID = 0; 1.27 BadArgs(String code, Object... args) { 1.28 + super(localize(code, args)); 1.29 this.code = code; 1.30 this.args = args; 1.31 } 1.32 @@ -124,7 +126,7 @@ 1.33 1.34 if (javacFiles.isEmpty()) { 1.35 if (!needHelp) 1.36 - out.println("no files given"); 1.37 + out.println(localize("dc.main.no.files.given")); 1.38 } 1.39 1.40 JavacTool tool = JavacTool.create(); 1.41 @@ -204,49 +206,9 @@ 1.42 } 1.43 1.44 void showHelp(PrintWriter out) { 1.45 - out.println("Usage:"); 1.46 - out.println(" doclint [options] source-files..."); 1.47 - out.println(""); 1.48 - out.println("Options:"); 1.49 - out.println(" -Xmsgs "); 1.50 - out.println(" Same as -Xmsgs:all"); 1.51 - out.println(" -Xmsgs:values"); 1.52 - out.println(" Specify categories of issues to be checked, where 'values'"); 1.53 - out.println(" is a comma-separated list of any of the following:"); 1.54 - out.println(" reference show places where comments contain incorrect"); 1.55 - out.println(" references to Java source code elements"); 1.56 - out.println(" syntax show basic syntax errors within comments"); 1.57 - out.println(" html show issues with HTML tags and attributes"); 1.58 - out.println(" accessibility show issues for accessibility"); 1.59 - out.println(" missing show issues with missing documentation"); 1.60 - out.println(" all all of the above"); 1.61 - out.println(" Precede a value with '-' to negate it"); 1.62 - out.println(" Categories may be qualified by one of:"); 1.63 - out.println(" /public /protected /package /private"); 1.64 - out.println(" For positive categories (not beginning with '-')"); 1.65 - out.println(" the qualifier applies to that access level and above."); 1.66 - out.println(" For negative categories (beginning with '-')"); 1.67 - out.println(" the qualifier applies to that access level and below."); 1.68 - out.println(" If a qualifier is missing, the category applies to"); 1.69 - out.println(" all access levels."); 1.70 - out.println(" For example, -Xmsgs:all,-syntax/private"); 1.71 - out.println(" This will enable all messages, except syntax errors"); 1.72 - out.println(" in the doc comments of private methods."); 1.73 - out.println(" If no -Xmsgs options are provided, the default is"); 1.74 - out.println(" equivalent to -Xmsgs:all/protected, meaning that"); 1.75 - out.println(" all messages are reported for protected and public"); 1.76 - out.println(" declarations only. "); 1.77 - out.println(" -stats"); 1.78 - out.println(" Report statistics on the reported issues."); 1.79 - out.println(" -h -help --help -usage -?"); 1.80 - out.println(" Show this message."); 1.81 - out.println(""); 1.82 - out.println("The following javac options are also supported"); 1.83 - out.println(" -bootclasspath, -classpath, -sourcepath, -Xmaxerrs, -Xmaxwarns"); 1.84 - out.println(""); 1.85 - out.println("To run doclint on part of a project, put the compiled classes for your"); 1.86 - out.println("project on the classpath (or bootclasspath), then specify the source files"); 1.87 - out.println("to be checked on the command line."); 1.88 + String msg = localize("dc.main.usage"); 1.89 + for (String line: msg.split("\n")) 1.90 + out.println(line); 1.91 } 1.92 1.93 List<File> splitPath(String path) { 1.94 @@ -353,6 +315,11 @@ 1.95 return false; 1.96 } 1.97 1.98 + private String localize(String code, Object... args) { 1.99 + Messages m = (env != null) ? env.messages : new Messages(null); 1.100 + return m.localize(code, args); 1.101 + } 1.102 + 1.103 // <editor-fold defaultstate="collapsed" desc="DeclScanner"> 1.104 1.105 static abstract class DeclScanner extends TreePathScanner<Void, Void> {