18 * limitations under the License. |
18 * limitations under the License. |
19 */ |
19 */ |
20 |
20 |
21 package com.sun.org.apache.xerces.internal.impl.msg; |
21 package com.sun.org.apache.xerces.internal.impl.msg; |
22 |
22 |
|
23 import com.sun.org.apache.xerces.internal.util.MessageFormatter; |
|
24 import com.sun.org.apache.xerces.internal.utils.SecuritySupport; |
23 import java.util.Locale; |
25 import java.util.Locale; |
24 import java.util.MissingResourceException; |
26 import java.util.MissingResourceException; |
25 import java.util.ResourceBundle; |
27 import java.util.ResourceBundle; |
26 import java.util.PropertyResourceBundle; |
|
27 |
|
28 import com.sun.org.apache.xerces.internal.util.MessageFormatter; |
|
29 |
28 |
30 /** |
29 /** |
31 * XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for |
30 * XMLMessageFormatter provides error messages for the XML 1.0 Recommendation and for |
32 * the Namespaces Recommendation |
31 * the Namespaces Recommendation |
33 * |
32 * |
34 * @xerces.internal |
33 * @xerces.internal |
35 * |
34 * |
36 * @author Eric Ye, IBM |
35 * @author Eric Ye, IBM |
37 * @version $Id: XMLMessageFormatter.java 3020 2011-02-28 23:51:33Z joehw $ |
36 * @version $Id: XMLMessageFormatter.java 3094 2012-03-21 05:50:01Z joehw $ |
38 * |
37 * |
39 */ |
38 */ |
40 public class XMLMessageFormatter implements MessageFormatter { |
39 public class XMLMessageFormatter implements MessageFormatter { |
41 /** |
40 /** |
42 * The domain of messages concerning the XML 1.0 specification. |
41 * The domain of messages concerning the XML 1.0 specification. |
70 public String formatMessage(Locale locale, String key, Object[] arguments) |
69 public String formatMessage(Locale locale, String key, Object[] arguments) |
71 throws MissingResourceException { |
70 throws MissingResourceException { |
72 |
71 |
73 if (fResourceBundle == null || locale != fLocale) { |
72 if (fResourceBundle == null || locale != fLocale) { |
74 if (locale != null) { |
73 if (locale != null) { |
75 fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale); |
74 fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale); |
76 // memorize the most-recent locale |
75 // memorize the most-recent locale |
77 fLocale = locale; |
76 fLocale = locale; |
78 } |
77 } |
79 if (fResourceBundle == null) |
78 if (fResourceBundle == null) |
80 fResourceBundle = PropertyResourceBundle.getBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"); |
79 fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages"); |
81 } |
80 } |
82 |
81 |
83 // format message |
82 // format message |
84 String msg; |
83 String msg; |
85 try { |
84 try { |