本文整理汇总了Java中com.sun.org.apache.xerces.internal.utils.SecuritySupport.getResourceBundle方法的典型用法代码示例。如果您正苦于以下问题:Java SecuritySupport.getResourceBundle方法的具体用法?Java SecuritySupport.getResourceBundle怎么用?Java SecuritySupport.getResourceBundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xerces.internal.utils.SecuritySupport
的用法示例。
在下文中一共展示了SecuritySupport.getResourceBundle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessage
import com.sun.org.apache.xerces.internal.utils.SecuritySupport; //导入方法依赖的package包/类
/**
* Overrides this method to get the formatted&localized error message.
*
* REVISIT: the system locale is used to load the property file.
* do we want to allow the appilcation to specify a
* different locale?
*/
public String getMessage() {
ResourceBundle resourceBundle = null;
resourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
if (resourceBundle == null)
throw new MissingResourceException("Property file not found!", "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key);
String msg = resourceBundle.getString(key);
if (msg == null) {
msg = resourceBundle.getString("BadMessageKey");
throw new MissingResourceException(msg, "com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", key);
}
if (args != null) {
try {
msg = java.text.MessageFormat.format(msg, args);
} catch (Exception e) {
msg = resourceBundle.getString("FormatFailed");
msg += " " + resourceBundle.getString(key);
}
}
return msg;
}
示例2: init
import com.sun.org.apache.xerces.internal.utils.SecuritySupport; //导入方法依赖的package包/类
/**
* Initialize Message Formatter.
*/
public static void init(){
if (locale != null) {
domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages", locale);
serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages", locale);
xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages", locale);
}else{
domResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.DOMMessages");
serResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSerializerMessages");
xmlResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLMessages");
}
}
示例3: formatMessage
import com.sun.org.apache.xerces.internal.utils.SecuritySupport; //导入方法依赖的package包/类
/**
* Formats a message with the specified arguments using the given
* locale information.
*
* @param locale The locale of the message.
* @param key The message key.
* @param arguments The message replacement text arguments. The order
* of the arguments must match that of the placeholders
* in the actual message.
*
* @return Returns the formatted message.
*
* @throws MissingResourceException Thrown if the message with the
* specified key cannot be found.
*/
public String formatMessage(Locale locale, String key, Object[] arguments)
throws MissingResourceException {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XMLSchemaMessages");
}
String msg = fResourceBundle.getString(key);
if (arguments != null) {
try {
msg = java.text.MessageFormat.format(msg, arguments);
} catch (Exception e) {
msg = fResourceBundle.getString("FormatFailed");
msg += " " + fResourceBundle.getString(key);
}
}
if (msg == null) {
msg = fResourceBundle.getString("BadMessageKey");
throw new MissingResourceException(msg, "com.sun.org.apache.xerces.internal.impl.msg.SchemaMessages", key);
}
return msg;
}
示例4: setLocale
import com.sun.org.apache.xerces.internal.utils.SecuritySupport; //导入方法依赖的package包/类
public void setLocale(Locale locale) {
try {
if (locale != null) {
this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message", locale);
}
else {
this.resources = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.xpath.regex.message");
}
}
catch (MissingResourceException mre) {
throw new RuntimeException("Installation Problem??? Couldn't load messages: "
+ mre.getMessage());
}
}
示例5: formatMessage
import com.sun.org.apache.xerces.internal.utils.SecuritySupport; //导入方法依赖的package包/类
/**
* Formats a message with the specified arguments using the given locale
* information.
*
* @param locale
* The locale of the message.
* @param key
* The message key.
* @param arguments
* The message replacement text arguments. The order of the
* arguments must match that of the placeholders in the actual
* message.
*
* @return Returns the formatted message.
*
* @throws MissingResourceException
* Thrown if the message with the specified key cannot be found.
*/
public String formatMessage(Locale locale, String key, Object[] arguments)
throws MissingResourceException {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
fResourceBundle = SecuritySupport.getResourceBundle(
"com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
fResourceBundle = SecuritySupport.getResourceBundle(
"com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages");
}
String msg = fResourceBundle.getString(key);
if (arguments != null) {
try {
msg = java.text.MessageFormat.format(msg, arguments);
} catch (Exception e) {
msg = fResourceBundle.getString("FormatFailed");
msg += " " + fResourceBundle.getString(key);
}
}
if (msg == null) {
msg = fResourceBundle.getString("BadMessageKey");
throw new MissingResourceException(msg,
"com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", key);
}
return msg;
}
示例6: formatMessage
import com.sun.org.apache.xerces.internal.utils.SecuritySupport; //导入方法依赖的package包/类
/**
* Formats a message with the specified arguments using the given
* locale information.
*
* @param locale The locale of the message.
* @param key The message key.
* @param arguments The message replacement text arguments. The order
* of the arguments must match that of the placeholders
* in the actual message.
*
* @return Returns the formatted message.
*
* @throws MissingResourceException Thrown if the message with the
* specified key cannot be found.
*/
public String formatMessage(Locale locale, String key, Object[] arguments)
throws MissingResourceException {
if (fResourceBundle == null || locale != fLocale) {
if (locale != null) {
fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", locale);
// memorize the most-recent locale
fLocale = locale;
}
if (fResourceBundle == null)
fResourceBundle = SecuritySupport.getResourceBundle("com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages");
}
String msg = fResourceBundle.getString(key);
if (arguments != null) {
try {
msg = java.text.MessageFormat.format(msg, arguments);
} catch (Exception e) {
msg = fResourceBundle.getString("FormatFailed");
msg += " " + fResourceBundle.getString(key);
}
}
if (msg == null) {
msg = fResourceBundle.getString("BadMessageKey");
throw new MissingResourceException(msg, "com.sun.org.apache.xerces.internal.impl.msg.XIncludeMessages", key);
}
return msg;
}