FileDocCategorySizeDatePackage
ToplinkLocalization.javaAPI DocGlassfish v2 API3712Tue May 22 16:54:36 BST 2007oracle.toplink.essentials.internal.localization

ToplinkLocalization

public abstract class ToplinkLocalization extends Object

Purpose: Any TopLink message in Foundation Library & J2EE Integration JARs should be a subclass of this class. Creation date: (7/12/00)

author
Shannon Chen
since
TOPLink/Java 5.0

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.StringbuildMessage(java.lang.String localizationClassName, java.lang.String key, java.lang.Object[] arguments)
Return the message for the given exception class and error number.

        String message = key;
        ResourceBundle bundle = null;

        // JDK 1.1 MessageFormat can't handle null arguments
        if (arguments != null) {
            for (int i = 0; i < arguments.length; i++) {
                if (arguments[i] == null) {
                    arguments[i] = "null";
                }
            }
        }

        bundle = ResourceBundle.getBundle("oracle.toplink.essentials.internal.localization.i18n." + localizationClassName + "Resource", Locale.getDefault());

        try {
            message = bundle.getString(key);
        } catch (java.util.MissingResourceException mre) {
            // Found bundle, but couldn't find translation.
            // Get the current language's NoTranslationForThisLocale message.
            bundle = ResourceBundle.getBundle("oracle.toplink.essentials.internal.localization.i18n.ToplinkLocalizationResource", Locale.getDefault());
            String noTranslationMessage = bundle.getString("NoTranslationForThisLocale");

            return MessageFormat.format(message, arguments) + noTranslationMessage;
        }
        return MessageFormat.format(message, arguments);