当前位置: 首页>>代码示例>>Java>>正文


Java SecuritySupport.getResourceBundle方法代码示例

本文整理汇总了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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:DatatypeException.java

示例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");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:DOMMessageFormatter.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:XSMessageFormatter.java

示例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());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:RegexParser.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:52,代码来源:XPointerMessageFormatter.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:46,代码来源:XIncludeMessageFormatter.java


注:本文中的com.sun.org.apache.xerces.internal.utils.SecuritySupport.getResourceBundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。