throws MissingResourceException Locale locale = Locale.getDefault(); return (ListResourceBundle)ResourceBundle.getBundle(className, locale); return (ListResourceBundle)ResourceBundle.getBundle( className, new Locale("en", "US")); throw new MissingResourceException( "Could not load any resource bundles." + className, className, "");
if (cl != null) { try { return ResourceBundle.getBundle(resourceBundleName, Locale.getDefault(), cl); } catch (MissingResourceException ignored) { if (cl != null) { try { return ResourceBundle.getBundle(resourceBundleName, Locale.getDefault(), cl); } catch (MissingResourceException ignored) { throw new MissingResourceException("Failed to load the specified resource bundle \"" + resourceBundleName + "\"", resourceBundleName, null);
return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale); return (XResourceBundle) ResourceBundle.getBundle( XSLT_RESOURCE, new Locale("en", "US")); throw new MissingResourceException( "Could not load any resource bundles.", className, "");
/** * Returns a {@link ResourceBundle} corresponding to the given {@link Locale} package and resource class. Falls-back * on the ROOT {@link Locale}, if the {@code fallbackOnRoot} flag is true and the requested Locale is not available. * * @param locale the {@link Locale} for which the {@link ResourceBundle} is being requested * @param packagePath * @param resourceClass * @param fallbackOnRoot if true, and a {@link ResourceBundle} cannot be found for the requested {@link Locale}, falls * back on the ROOT {@link Locale} * @return a {@link ResourceBundle} corresponding to the given {@link Locale} package and resource class */ public static ResourceBundle getBundle( final Locale locale, final String packagePath, final Class<?> resourceClass, final boolean fallbackOnRoot ) { final GlobalMessageControl control = new GlobalMessageControl( fallbackOnRoot ); final String resourceName = control.toResourceName( control.toBundleName( packagePath, locale ), "properties" ); ResourceBundle bundle; try { bundle = ResourceBundle.getBundle( packagePath, locale, resourceClass.getClassLoader(), new GlobalMessageControl( fallbackOnRoot ) ); } catch ( final MissingResourceException e ) { final StringBuilder msg = new StringBuilder(); msg.append( "Unable to find properties file '" ).append( resourceName ).append( "': " ).append( e.toString() ); throw new MissingResourceException( msg.toString(), resourceClass.getName(), packagePath ); } return bundle; }
public static TResourceBundle getBundle(String bundleName, Locale locale, ClassLoader loader) throws MissingResourceException { if (loader == null) { throw new NullPointerException(); } if (bundleName != null) { TResourceBundle bundle; if (!locale.equals(Locale.getDefault())) { bundle = handleGetBundle(bundleName, "_" + locale, false); if (bundle != null) { return bundle; } } bundle = handleGetBundle(bundleName, "_" + Locale.getDefault(), true); if (bundle != null) { return bundle; } throw new MissingResourceException("Bundle not found", bundleName + "_" + locale, ""); } throw new NullPointerException(); }
Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); return (XPATHErrorResources) ResourceBundle.getBundle(className + suffix, locale); return (XPATHErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); throw new MissingResourceException( "Could not load any resource bundles.", className, "");
static ResourceBundle loadResourceBundle(String resourceBundleName) { // try context class loader to load the resource ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl != null) { try { return ResourceBundle.getBundle(resourceBundleName, Locale.getDefault(), cl); } catch (MissingResourceException ignored) { // Failed to load using context class loader, ignore } } // try system class loader to load the resource cl = ClassLoader.getSystemClassLoader(); if (cl != null) { try { return ResourceBundle.getBundle(resourceBundleName, Locale.getDefault(), cl); } catch (MissingResourceException ignored) { // Failed to load using system class loader, ignore } } throw new MissingResourceException("Failed to load the specified resource bundle \"" + resourceBundleName + "\"", resourceBundleName, null); }
ResourceBundle.getBundle(m_resourceBundleName, locale); lrb = (ListResourceBundle) rb; (ListResourceBundle) ResourceBundle.getBundle( m_resourceBundleName, new Locale("en", "US")); throw new MissingResourceException( "Could not load any resource bundles." + m_resourceBundleName, m_resourceBundleName,
/** * Find or create a logger for a named package/class. * If a logger has already been created with the given name * it is returned. Otherwise a new logger is created. By default a logger * that uses java.util.logging will be returned. * * @param messageCatalogName the resource bundle containing the logging messages. * @param loggerID unique name to identify this logger. * @return a suitable Logger. */ public static Logger getLogger(String messageCatalogName, String loggerID) { String loggerClassName = overrideloggerClassName; Logger logger = null; if (loggerClassName == null) { loggerClassName = jsr47LoggerClassName; } // logger = getJSR47Logger(ResourceBundle.getBundle(messageCatalogName), loggerID, null) ; logger = getLogger(loggerClassName, ResourceBundle.getBundle(messageCatalogName), loggerID, null) ; // } if (null == logger) { throw new MissingResourceException("Error locating the logging class", CLASS_NAME, loggerID); } return logger; }
private static TResourceBundle getBundleImpl(String bundleName, Locale locale, ClassLoader loader) throws MissingResourceException { if (bundleName != null) { TResourceBundle bundle; if (!locale.equals(Locale.getDefault())) { String localeName = locale.toString(); if (localeName.length() > 0) { localeName = "_" + localeName; } bundle = handleGetBundle(bundleName, localeName, false); if (bundle != null) { return bundle; } } String localeName = Locale.getDefault().toString(); if (localeName.length() > 0) { localeName = "_" + localeName; } bundle = handleGetBundle(bundleName, localeName, true); if (bundle != null) { return bundle; } throw new MissingResourceException("Bundle not found", bundleName + '_' + locale, ""); } throw new NullPointerException(); }
Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); return (XSLTErrorResources) ResourceBundle.getBundle(className + suffix, locale); return (XSLTErrorResources) ResourceBundle.getBundle(className, new Locale("en", "US")); throw new MissingResourceException( "Could not load any resource bundles.", className, "");
return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale); return (XResourceBundle) ResourceBundle.getBundle( XSLT_RESOURCE, new Locale("en", "US")); throw new MissingResourceException( "Could not load any resource bundles.", className, "");
resourceBundle = ResourceBundle.getBundle("org.apache.jena.ext.xerces.impl.msg.XMLSchemaMessages"); if (resourceBundle == null) throw new MissingResourceException("Property file not found!", "org.apache.jena.ext.xerces.impl.msg.XMLSchemaMessages", key); throw new MissingResourceException(msg, "org.apache.jena.ext.xerces.impl.msg.XMLSchemaMessages", key);
Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("tr", "TR")); throw new MissingResourceException( "Could not load any resource bundles.", className, "");
ResourceBundle.getBundle(m_resourceBundleName, locale); lrb = (ListResourceBundle) rb; (ListResourceBundle) ResourceBundle.getBundle( m_resourceBundleName, new Locale("en", "US")); throw new MissingResourceException( "Could not load any resource bundles." + m_resourceBundleName, m_resourceBundleName,
public ResourceBundle getApplicationBundle(FacesContext facesContext, Enum<?> messageKey, Locale locale) throws MissingResourceException { if (facesContext == null) { throw new MissingResourceException("FacesContext is null", getClass().getName(), messageKey.toString()); } Application application = facesContext.getApplication(); if (application == null || application.getMessageBundle() == null) { throw new MissingResourceException("Cannot read message bundle name from application", getClass().getName(), messageKey.toString()); } return ResourceBundle.getBundle(application.getMessageBundle(), locale, getClassLoader()); } }
Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("sl", "SL")); throw new MissingResourceException( "Could not load any resource bundles.", className, "");
/** * Find or create a logger for a named package/class. * If a logger has already been created with the given name * it is returned. Otherwise a new logger is created. By default a logger * that uses java.util.logging will be returned. * * @param messageCatalogName the resource bundle containing the logging messages. * @param loggerID unique name to identify this logger. * @return a suitable Logger. */ public static Logger getLogger(String messageCatalogName, String loggerID) { String loggerClassName = overrideloggerClassName; Logger logger = null; if (loggerClassName == null) { loggerClassName = jsr47LoggerClassName; } // logger = getJSR47Logger(ResourceBundle.getBundle(messageCatalogName), loggerID, null) ; logger = getLogger(loggerClassName, ResourceBundle.getBundle(messageCatalogName), loggerID, null) ; // } if (null == logger) { throw new MissingResourceException("Error locating the logging class", CLASS_NAME, loggerID); } return logger; }
Locale locale = Locale.getDefault(); String suffix = getResourceSuffix(locale); return (XMLErrorResources) ResourceBundle.getBundle(className + suffix, locale); return (XMLErrorResources) ResourceBundle.getBundle(className, new Locale("cs", "CZ")); throw new MissingResourceException( "Could not load any resource bundles.", className, "");
/** * Find or create a logger for a named package/class. * If a logger has already been created with the given name * it is returned. Otherwise a new logger is created. By default a logger * that uses java.util.logging will be returned. * * @param messageCatalogName the resource bundle containing the logging messages. * @param loggerID unique name to identify this logger. * @return a suitable Logger. */ public static Logger getLogger(String messageCatalogName, String loggerID) { String loggerClassName = overrideloggerClassName; Logger logger = null; if (loggerClassName == null) { loggerClassName = jsr47LoggerClassName; } // logger = getJSR47Logger(ResourceBundle.getBundle(messageCatalogName), loggerID, null) ; logger = getLogger(loggerClassName, ResourceBundle.getBundle(messageCatalogName), loggerID, null) ; // } if (null == logger) { throw new MissingResourceException("Error locating the logging class", CLASS_NAME, loggerID); } return logger; }