20 /* |
20 /* |
21 * $Id: XSLMessages.java,v 1.2.4.1 2005/09/09 07:41:10 pvedula Exp $ |
21 * $Id: XSLMessages.java,v 1.2.4.1 2005/09/09 07:41:10 pvedula Exp $ |
22 */ |
22 */ |
23 package com.sun.org.apache.xalan.internal.res; |
23 package com.sun.org.apache.xalan.internal.res; |
24 |
24 |
|
25 import com.sun.org.apache.xalan.internal.utils.SecuritySupport; |
25 import java.util.ListResourceBundle; |
26 import java.util.ListResourceBundle; |
26 |
27 |
27 import com.sun.org.apache.xpath.internal.res.XPATHMessages; |
28 import com.sun.org.apache.xpath.internal.res.XPATHMessages; |
28 |
29 |
29 /** |
30 /** |
30 * Sets things up for issuing error messages. This class is misnamed, and |
31 * Sets things up for issuing error messages. This class is misnamed, and should |
31 * should be called XalanMessages, or some such. |
32 * be called XalanMessages, or some such. |
|
33 * |
32 * @xsl.usage internal |
34 * @xsl.usage internal |
33 */ |
35 */ |
34 public class XSLMessages extends XPATHMessages |
36 public class XSLMessages extends XPATHMessages { |
35 { |
|
36 |
37 |
37 /** The language specific resource object for Xalan messages. */ |
38 /** |
38 private static ListResourceBundle XSLTBundle = null; |
39 * The language specific resource object for Xalan messages. |
|
40 */ |
|
41 private static ListResourceBundle XSLTBundle = null; |
|
42 /** |
|
43 * The class name of the Xalan error message string table. |
|
44 */ |
|
45 private static final String XSLT_ERROR_RESOURCES = |
|
46 "com.sun.org.apache.xalan.internal.res.XSLTErrorResources"; |
39 |
47 |
40 /** The class name of the Xalan error message string table. */ |
48 /** |
41 private static final String XSLT_ERROR_RESOURCES = |
49 * Creates a message from the specified key and replacement arguments, |
42 "com.sun.org.apache.xalan.internal.res.XSLTErrorResources"; |
50 * localized to the given locale. |
|
51 * |
|
52 * @param msgKey The key for the message text. |
|
53 * @param args The arguments to be used as replacement text in the message |
|
54 * created. |
|
55 * |
|
56 * @return The formatted message string. |
|
57 */ |
|
58 public static String createMessage(String msgKey, Object args[]) //throws Exception |
|
59 { |
|
60 if (XSLTBundle == null) { |
|
61 XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); |
|
62 } |
43 |
63 |
44 /** |
64 if (XSLTBundle != null) { |
45 * Creates a message from the specified key and replacement |
65 return createMsg(XSLTBundle, msgKey, args); |
46 * arguments, localized to the given locale. |
66 } else { |
47 * |
67 return "Could not load any resource bundles."; |
48 * @param msgKey The key for the message text. |
68 } |
49 * @param args The arguments to be used as replacement text |
69 } |
50 * in the message created. |
|
51 * |
|
52 * @return The formatted message string. |
|
53 */ |
|
54 public static final String createMessage(String msgKey, Object args[]) //throws Exception |
|
55 { |
|
56 if (XSLTBundle == null) |
|
57 XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES); |
|
58 |
70 |
59 if (XSLTBundle != null) |
71 /** |
|
72 * Creates a message from the specified key and replacement arguments, |
|
73 * localized to the given locale. |
|
74 * |
|
75 * @param msgKey The key for the message text. |
|
76 * @param args The arguments to be used as replacement text in the message |
|
77 * created. |
|
78 * |
|
79 * @return The formatted warning string. |
|
80 */ |
|
81 public static String createWarning(String msgKey, Object args[]) //throws Exception |
60 { |
82 { |
61 return createMsg(XSLTBundle, msgKey, args); |
83 if (XSLTBundle == null) { |
|
84 XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES); |
|
85 } |
|
86 |
|
87 if (XSLTBundle != null) { |
|
88 return createMsg(XSLTBundle, msgKey, args); |
|
89 } else { |
|
90 return "Could not load any resource bundles."; |
|
91 } |
62 } |
92 } |
63 else |
|
64 return "Could not load any resource bundles."; |
|
65 } |
|
66 |
|
67 /** |
|
68 * Creates a message from the specified key and replacement |
|
69 * arguments, localized to the given locale. |
|
70 * |
|
71 * @param msgKey The key for the message text. |
|
72 * @param args The arguments to be used as replacement text |
|
73 * in the message created. |
|
74 * |
|
75 * @return The formatted warning string. |
|
76 */ |
|
77 public static final String createWarning(String msgKey, Object args[]) //throws Exception |
|
78 { |
|
79 if (XSLTBundle == null) |
|
80 XSLTBundle = loadResourceBundle(XSLT_ERROR_RESOURCES); |
|
81 |
|
82 if (XSLTBundle != null) |
|
83 { |
|
84 return createMsg(XSLTBundle, msgKey, args); |
|
85 } |
|
86 else |
|
87 return "Could not load any resource bundles."; |
|
88 } |
|
89 } |
93 } |