6
|
1 |
/*
|
|
2 |
* reserved comment block
|
|
3 |
* DO NOT REMOVE OR ALTER!
|
|
4 |
*/
|
|
5 |
/*
|
|
6 |
* Copyright 1999-2004 The Apache Software Foundation.
|
|
7 |
*
|
|
8 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9 |
* you may not use this file except in compliance with the License.
|
|
10 |
* You may obtain a copy of the License at
|
|
11 |
*
|
|
12 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13 |
*
|
|
14 |
* Unless required by applicable law or agreed to in writing, software
|
|
15 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17 |
* See the License for the specific language governing permissions and
|
|
18 |
* limitations under the License.
|
|
19 |
*/
|
|
20 |
/*
|
|
21 |
* $Id: XSLMessages.java,v 1.2.4.1 2005/09/09 07:41:10 pvedula Exp $
|
|
22 |
*/
|
|
23 |
package com.sun.org.apache.xalan.internal.res;
|
|
24 |
|
16953
|
25 |
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
|
6
|
26 |
import java.util.ListResourceBundle;
|
|
27 |
|
|
28 |
import com.sun.org.apache.xpath.internal.res.XPATHMessages;
|
|
29 |
|
|
30 |
/**
|
16953
|
31 |
* Sets things up for issuing error messages. This class is misnamed, and should
|
|
32 |
* be called XalanMessages, or some such.
|
|
33 |
*
|
6
|
34 |
* @xsl.usage internal
|
|
35 |
*/
|
16953
|
36 |
public class XSLMessages extends XPATHMessages {
|
6
|
37 |
|
16953
|
38 |
/**
|
|
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";
|
6
|
47 |
|
16953
|
48 |
/**
|
|
49 |
* Creates a message from the specified key and replacement arguments,
|
|
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
|
6
|
59 |
{
|
16953
|
60 |
if (XSLTBundle == null) {
|
|
61 |
XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
|
|
62 |
}
|
|
63 |
|
|
64 |
if (XSLTBundle != null) {
|
|
65 |
return createMsg(XSLTBundle, msgKey, args);
|
|
66 |
} else {
|
|
67 |
return "Could not load any resource bundles.";
|
|
68 |
}
|
6
|
69 |
}
|
|
70 |
|
16953
|
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
|
|
82 |
{
|
|
83 |
if (XSLTBundle == null) {
|
|
84 |
XSLTBundle = SecuritySupport.getResourceBundle(XSLT_ERROR_RESOURCES);
|
|
85 |
}
|
6
|
86 |
|
16953
|
87 |
if (XSLTBundle != null) {
|
|
88 |
return createMsg(XSLTBundle, msgKey, args);
|
|
89 |
} else {
|
|
90 |
return "Could not load any resource bundles.";
|
|
91 |
}
|
6
|
92 |
}
|
|
93 |
}
|