FileDocCategorySizeDatePackage
XPointerMessageFormatter.javaAPI DocJava SE 6 API3375Tue Jun 10 00:22:54 BST 2008com.sun.org.apache.xerces.internal.xpointer

XPointerMessageFormatter

public class XPointerMessageFormatter extends Object implements MessageFormatter
XPointerMessageFormatter provides error messages for the XPointer Framework and element() Scheme Recommendations.
xerces.internal
version
$Id: XPointerMessageFormatter.java,v 1.1.4.1 2005/09/08 05:25:45 sunithareddy Exp $

Fields Summary
public static final String
XPOINTER_DOMAIN
private Locale
fLocale
private ResourceBundle
fResourceBundle
Constructors Summary
Methods Summary
public java.lang.StringformatMessage(java.util.Locale locale, java.lang.String key, java.lang.Object[] arguments)
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.


                                                                                                                                               
           
              

        if (fResourceBundle == null || locale != fLocale) {
            if (locale != null) {
                fResourceBundle = PropertyResourceBundle.getBundle(
                        "com.sun.org.apache.xerces.internal.impl.msg.XPointerMessages", locale);
                // memorize the most-recent locale
                fLocale = locale;
            }
            if (fResourceBundle == null)
                fResourceBundle = PropertyResourceBundle
                        .getBundle("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;