1.1 --- a/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Mon Mar 09 13:34:19 2009 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/util/RawDiagnosticFormatter.java Mon Mar 09 23:53:41 2009 -0700 1.3 @@ -54,7 +54,7 @@ 1.4 } 1.5 1.6 //provide common default formats 1.7 - public String format(JCDiagnostic d, Locale l) { 1.8 + public String formatDiagnostic(JCDiagnostic d, Locale l) { 1.9 try { 1.10 StringBuffer buf = new StringBuffer(); 1.11 if (d.getPosition() != Position.NOPOS) { 1.12 @@ -82,17 +82,11 @@ 1.13 public String formatMessage(JCDiagnostic d, Locale l) { 1.14 StringBuilder buf = new StringBuilder(); 1.15 Collection<String> args = formatArguments(d, l); 1.16 - buf.append(d.getCode()); 1.17 - String sep = ": "; 1.18 - for (Object o : args) { 1.19 - buf.append(sep); 1.20 - buf.append(o); 1.21 - sep = ", "; 1.22 - } 1.23 + buf.append(localize(null, d.getCode(), args.toArray())); 1.24 if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { 1.25 List<String> subDiags = formatSubdiagnostics(d, null); 1.26 if (subDiags.nonEmpty()) { 1.27 - sep = ""; 1.28 + String sep = ""; 1.29 buf.append(",{"); 1.30 for (String sub : formatSubdiagnostics(d, null)) { 1.31 buf.append(sep); 1.32 @@ -117,4 +111,17 @@ 1.33 else 1.34 return s; 1.35 } 1.36 + 1.37 + @Override 1.38 + protected String localize(Locale l, String key, Object... args) { 1.39 + StringBuilder buf = new StringBuilder(); 1.40 + buf.append(key); 1.41 + String sep = ": "; 1.42 + for (Object o : args) { 1.43 + buf.append(sep); 1.44 + buf.append(o); 1.45 + sep = ", "; 1.46 + } 1.47 + return buf.toString(); 1.48 + } 1.49 }