< prev index next >
src/java.base/share/classes/java/util/ResourceBundle.java
Print this page
rev 56290 : 8230648: Replace @exception tag with @throws in java.base
Summary: Minor coding style update of javadoc tag in any file in java.base
Reviewed-by: prappo, lancea
*** 510,522 ****
* <blockquote>
* <code>(String) {@link #getObject(java.lang.String) getObject}(key)</code>.
* </blockquote>
*
* @param key the key for the desired string
! * @exception NullPointerException if <code>key</code> is <code>null</code>
! * @exception MissingResourceException if no object for the given key can be found
! * @exception ClassCastException if the object found for the given key is not a string
* @return the string for the given key
*/
public final String getString(String key) {
return (String) getObject(key);
}
--- 510,522 ----
* <blockquote>
* <code>(String) {@link #getObject(java.lang.String) getObject}(key)</code>.
* </blockquote>
*
* @param key the key for the desired string
! * @throws NullPointerException if <code>key</code> is <code>null</code>
! * @throws MissingResourceException if no object for the given key can be found
! * @throws ClassCastException if the object found for the given key is not a string
* @return the string for the given key
*/
public final String getString(String key) {
return (String) getObject(key);
}
*** 527,539 ****
* <blockquote>
* <code>(String[]) {@link #getObject(java.lang.String) getObject}(key)</code>.
* </blockquote>
*
* @param key the key for the desired string array
! * @exception NullPointerException if <code>key</code> is <code>null</code>
! * @exception MissingResourceException if no object for the given key can be found
! * @exception ClassCastException if the object found for the given key is not a string array
* @return the string array for the given key
*/
public final String[] getStringArray(String key) {
return (String[]) getObject(key);
}
--- 527,539 ----
* <blockquote>
* <code>(String[]) {@link #getObject(java.lang.String) getObject}(key)</code>.
* </blockquote>
*
* @param key the key for the desired string array
! * @throws NullPointerException if <code>key</code> is <code>null</code>
! * @throws MissingResourceException if no object for the given key can be found
! * @throws ClassCastException if the object found for the given key is not a string array
* @return the string array for the given key
*/
public final String[] getStringArray(String key) {
return (String[]) getObject(key);
}
*** 545,556 ****
* If not successful, and the parent resource bundle is not null,
* it calls the parent's <code>getObject</code> method.
* If still not successful, it throws a MissingResourceException.
*
* @param key the key for the desired object
! * @exception NullPointerException if <code>key</code> is <code>null</code>
! * @exception MissingResourceException if no object for the given key can be found
* @return the object for the given key
*/
public final Object getObject(String key) {
Object obj = handleGetObject(key);
if (obj == null) {
--- 545,556 ----
* If not successful, and the parent resource bundle is not null,
* it calls the parent's <code>getObject</code> method.
* If still not successful, it throws a MissingResourceException.
*
* @param key the key for the desired object
! * @throws NullPointerException if <code>key</code> is <code>null</code>
! * @throws MissingResourceException if no object for the given key can be found
* @return the object for the given key
*/
public final Object getObject(String key) {
Object obj = handleGetObject(key);
if (obj == null) {
*** 839,851 ****
* <blockquote>
* <code>getBundle(baseName, Locale.getDefault(), callerModule)</code>,
* </blockquote>
*
* @param baseName the base name of the resource bundle, a fully qualified class name
! * @exception java.lang.NullPointerException
* if <code>baseName</code> is <code>null</code>
! * @exception MissingResourceException
* if no resource bundle for the specified base name can be found
* @return a resource bundle for the given base name and the default locale
*
* @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
* @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
--- 839,851 ----
* <blockquote>
* <code>getBundle(baseName, Locale.getDefault(), callerModule)</code>,
* </blockquote>
*
* @param baseName the base name of the resource bundle, a fully qualified class name
! * @throws java.lang.NullPointerException
* if <code>baseName</code> is <code>null</code>
! * @throws MissingResourceException
* if no resource bundle for the specified base name can be found
* @return a resource bundle for the given base name and the default locale
*
* @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
* @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
*** 913,925 ****
*
* @param baseName
* the base name of the resource bundle, a fully qualified class name
* @param locale
* the locale for which a resource bundle is desired
! * @exception NullPointerException
* if <code>baseName</code> or <code>locale</code> is <code>null</code>
! * @exception MissingResourceException
* if no resource bundle for the specified base name can be found
* @return a resource bundle for the given base name and locale
*
* @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
* @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
--- 913,925 ----
*
* @param baseName
* the base name of the resource bundle, a fully qualified class name
* @param locale
* the locale for which a resource bundle is desired
! * @throws NullPointerException
* if <code>baseName</code> or <code>locale</code> is <code>null</code>
! * @throws MissingResourceException
* if no resource bundle for the specified base name can be found
* @return a resource bundle for the given base name and locale
*
* @see <a href="#default_behavior">Resource Bundle Search and Loading Strategy</a>
* @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
*** 1262,1274 ****
*
* @param baseName the base name of the resource bundle, a fully qualified class name
* @param locale the locale for which a resource bundle is desired
* @param loader the class loader from which to load the resource bundle
* @return a resource bundle for the given base name and locale
! * @exception java.lang.NullPointerException
* if <code>baseName</code>, <code>locale</code>, or <code>loader</code> is <code>null</code>
! * @exception MissingResourceException
* if no resource bundle for the specified base name can be found
* @since 1.2
* @revised 9
* @spec JPMS
* @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
--- 1262,1274 ----
*
* @param baseName the base name of the resource bundle, a fully qualified class name
* @param locale the locale for which a resource bundle is desired
* @param loader the class loader from which to load the resource bundle
* @return a resource bundle for the given base name and locale
! * @throws java.lang.NullPointerException
* if <code>baseName</code>, <code>locale</code>, or <code>loader</code> is <code>null</code>
! * @throws MissingResourceException
* if no resource bundle for the specified base name can be found
* @since 1.2
* @revised 9
* @spec JPMS
* @see <a href="#resource-bundle-modules">Resource Bundles and Named Modules</a>
*** 2248,2258 ****
/**
* Removes all resource bundles from the cache that have been loaded
* by the given class loader.
*
* @param loader the class loader
! * @exception NullPointerException if <code>loader</code> is null
* @since 1.6
* @see ResourceBundle.Control#getTimeToLive(String,Locale)
*/
public static final void clearCache(ClassLoader loader) {
Objects.requireNonNull(loader);
--- 2248,2258 ----
/**
* Removes all resource bundles from the cache that have been loaded
* by the given class loader.
*
* @param loader the class loader
! * @throws NullPointerException if <code>loader</code> is null
* @since 1.6
* @see ResourceBundle.Control#getTimeToLive(String,Locale)
*/
public static final void clearCache(ClassLoader loader) {
Objects.requireNonNull(loader);
*** 2269,2279 ****
* Gets an object for the given key from this resource bundle.
* Returns null if this resource bundle does not contain an
* object for the given key.
*
* @param key the key for the desired object
! * @exception NullPointerException if <code>key</code> is <code>null</code>
* @return the object for the given key, or null
*/
protected abstract Object handleGetObject(String key);
/**
--- 2269,2279 ----
* Gets an object for the given key from this resource bundle.
* Returns null if this resource bundle does not contain an
* object for the given key.
*
* @param key the key for the desired object
! * @throws NullPointerException if <code>key</code> is <code>null</code>
* @return the object for the given key, or null
*/
protected abstract Object handleGetObject(String key);
/**
*** 2291,2301 ****
* @param key
* the resource <code>key</code>
* @return <code>true</code> if the given <code>key</code> is
* contained in this <code>ResourceBundle</code> or its
* parent bundles; <code>false</code> otherwise.
! * @exception NullPointerException
* if <code>key</code> is <code>null</code>
* @since 1.6
*/
public boolean containsKey(String key) {
if (key == null) {
--- 2291,2301 ----
* @param key
* the resource <code>key</code>
* @return <code>true</code> if the given <code>key</code> is
* contained in this <code>ResourceBundle</code> or its
* parent bundles; <code>false</code> otherwise.
! * @throws NullPointerException
* if <code>key</code> is <code>null</code>
* @since 1.6
*/
public boolean containsKey(String key) {
if (key == null) {
*** 2596,2608 ****
* @param formats
* the formats to be returned by the
* <code>ResourceBundle.Control.getFormats</code> method
* @return a <code>ResourceBundle.Control</code> supporting the
* specified <code>formats</code>
! * @exception NullPointerException
* if <code>formats</code> is <code>null</code>
! * @exception IllegalArgumentException
* if <code>formats</code> is unknown
*/
public static final Control getControl(List<String> formats) {
if (formats.equals(Control.FORMAT_PROPERTIES)) {
return SingleFormatControl.PROPERTIES_ONLY;
--- 2596,2608 ----
* @param formats
* the formats to be returned by the
* <code>ResourceBundle.Control.getFormats</code> method
* @return a <code>ResourceBundle.Control</code> supporting the
* specified <code>formats</code>
! * @throws NullPointerException
* if <code>formats</code> is <code>null</code>
! * @throws IllegalArgumentException
* if <code>formats</code> is unknown
*/
public static final Control getControl(List<String> formats) {
if (formats.equals(Control.FORMAT_PROPERTIES)) {
return SingleFormatControl.PROPERTIES_ONLY;
*** 2631,2643 ****
* the formats to be returned by the
* <code>ResourceBundle.Control.getFormats</code> method
* @return a <code>ResourceBundle.Control</code> supporting the
* specified <code>formats</code> with no fallback
* <code>Locale</code> support
! * @exception NullPointerException
* if <code>formats</code> is <code>null</code>
! * @exception IllegalArgumentException
* if <code>formats</code> is unknown
*/
public static final Control getNoFallbackControl(List<String> formats) {
if (formats.equals(Control.FORMAT_DEFAULT)) {
return NoFallbackControl.NO_FALLBACK;
--- 2631,2643 ----
* the formats to be returned by the
* <code>ResourceBundle.Control.getFormats</code> method
* @return a <code>ResourceBundle.Control</code> supporting the
* specified <code>formats</code> with no fallback
* <code>Locale</code> support
! * @throws NullPointerException
* if <code>formats</code> is <code>null</code>
! * @throws IllegalArgumentException
* if <code>formats</code> is unknown
*/
public static final Control getNoFallbackControl(List<String> formats) {
if (formats.equals(Control.FORMAT_DEFAULT)) {
return NoFallbackControl.NO_FALLBACK;
*** 2677,2687 ****
* @param baseName
* the base name of the resource bundle, a fully qualified class
* name
* @return a <code>List</code> of <code>String</code>s containing
* formats for loading resource bundles.
! * @exception NullPointerException
* if <code>baseName</code> is null
* @see #FORMAT_DEFAULT
* @see #FORMAT_CLASS
* @see #FORMAT_PROPERTIES
*/
--- 2677,2687 ----
* @param baseName
* the base name of the resource bundle, a fully qualified class
* name
* @return a <code>List</code> of <code>String</code>s containing
* formats for loading resource bundles.
! * @throws NullPointerException
* if <code>baseName</code> is null
* @see #FORMAT_DEFAULT
* @see #FORMAT_CLASS
* @see #FORMAT_PROPERTIES
*/
*** 2864,2874 ****
* qualified class name
* @param locale
* the locale for which a resource bundle is desired
* @return a <code>List</code> of candidate
* <code>Locale</code>s for the given <code>locale</code>
! * @exception NullPointerException
* if <code>baseName</code> or <code>locale</code> is
* <code>null</code>
*/
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
if (baseName == null) {
--- 2864,2874 ----
* qualified class name
* @param locale
* the locale for which a resource bundle is desired
* @return a <code>List</code> of candidate
* <code>Locale</code>s for the given <code>locale</code>
! * @throws NullPointerException
* if <code>baseName</code> or <code>locale</code> is
* <code>null</code>
*/
public List<Locale> getCandidateLocales(String baseName, Locale locale) {
if (baseName == null) {
*** 3032,3042 ****
* unable to find any resource bundles (except for the
* base bundle)
* @return a <code>Locale</code> for the fallback search,
* or <code>null</code> if no further fallback search
* is desired.
! * @exception NullPointerException
* if <code>baseName</code> or <code>locale</code>
* is <code>null</code>
*/
public Locale getFallbackLocale(String baseName, Locale locale) {
if (baseName == null) {
--- 3032,3042 ----
* unable to find any resource bundles (except for the
* base bundle)
* @return a <code>Locale</code> for the fallback search,
* or <code>null</code> if no further fallback search
* is desired.
! * @throws NullPointerException
* if <code>baseName</code> or <code>locale</code>
* is <code>null</code>
*/
public Locale getFallbackLocale(String baseName, Locale locale) {
if (baseName == null) {
*** 3125,3157 ****
* the flag to indicate bundle reloading; <code>true</code>
* if reloading an expired resource bundle,
* <code>false</code> otherwise
* @return the resource bundle instance,
* or <code>null</code> if none could be found.
! * @exception NullPointerException
* if <code>bundleName</code>, <code>locale</code>,
* <code>format</code>, or <code>loader</code> is
* <code>null</code>, or if <code>null</code> is returned by
* {@link #toBundleName(String, Locale) toBundleName}
! * @exception IllegalArgumentException
* if <code>format</code> is unknown, or if the resource
* found for the given parameters contains malformed data.
! * @exception ClassCastException
* if the loaded class cannot be cast to <code>ResourceBundle</code>
! * @exception IllegalAccessException
* if the class or its nullary constructor is not
* accessible.
! * @exception InstantiationException
* if the instantiation of a class fails for some other
* reason.
! * @exception ExceptionInInitializerError
* if the initialization provoked by this method fails.
! * @exception SecurityException
* If a security manager is present and creation of new
* instances is denied. See {@link Class#newInstance()}
* for details.
! * @exception IOException
* if an error occurred when reading resources using
* any I/O operations
* @see java.util.spi.ResourceBundleProvider#getBundle(String, Locale)
* @revised 9
* @spec JPMS
--- 3125,3157 ----
* the flag to indicate bundle reloading; <code>true</code>
* if reloading an expired resource bundle,
* <code>false</code> otherwise
* @return the resource bundle instance,
* or <code>null</code> if none could be found.
! * @throws NullPointerException
* if <code>bundleName</code>, <code>locale</code>,
* <code>format</code>, or <code>loader</code> is
* <code>null</code>, or if <code>null</code> is returned by
* {@link #toBundleName(String, Locale) toBundleName}
! * @throws IllegalArgumentException
* if <code>format</code> is unknown, or if the resource
* found for the given parameters contains malformed data.
! * @throws ClassCastException
* if the loaded class cannot be cast to <code>ResourceBundle</code>
! * @throws IllegalAccessException
* if the class or its nullary constructor is not
* accessible.
! * @throws InstantiationException
* if the instantiation of a class fails for some other
* reason.
! * @throws ExceptionInInitializerError
* if the initialization provoked by this method fails.
! * @throws SecurityException
* If a security manager is present and creation of new
* instances is denied. See {@link Class#newInstance()}
* for details.
! * @throws IOException
* if an error occurred when reading resources using
* any I/O operations
* @see java.util.spi.ResourceBundleProvider#getBundle(String, Locale)
* @revised 9
* @spec JPMS
*** 3293,3303 ****
* @return the time (0 or a positive millisecond offset from the
* cached time) to get loaded bundles expired in the cache,
* {@link #TTL_NO_EXPIRATION_CONTROL} to disable the
* expiration control, or {@link #TTL_DONT_CACHE} to disable
* caching.
! * @exception NullPointerException
* if <code>baseName</code> or <code>locale</code> is
* <code>null</code>
*/
public long getTimeToLive(String baseName, Locale locale) {
if (baseName == null || locale == null) {
--- 3293,3303 ----
* @return the time (0 or a positive millisecond offset from the
* cached time) to get loaded bundles expired in the cache,
* {@link #TTL_NO_EXPIRATION_CONTROL} to disable the
* expiration control, or {@link #TTL_DONT_CACHE} to disable
* caching.
! * @throws NullPointerException
* if <code>baseName</code> or <code>locale</code> is
* <code>null</code>
*/
public long getTimeToLive(String baseName, Locale locale) {
if (baseName == null || locale == null) {
*** 3348,3358 ****
* @param loadTime
* the time when <code>bundle</code> was loaded and put
* in the cache
* @return <code>true</code> if the expired bundle needs to be
* reloaded; <code>false</code> otherwise.
! * @exception NullPointerException
* if <code>baseName</code>, <code>locale</code>,
* <code>format</code>, <code>loader</code>, or
* <code>bundle</code> is <code>null</code>
*/
public boolean needsReload(String baseName, Locale locale,
--- 3348,3358 ----
* @param loadTime
* the time when <code>bundle</code> was loaded and put
* in the cache
* @return <code>true</code> if the expired bundle needs to be
* reloaded; <code>false</code> otherwise.
! * @throws NullPointerException
* if <code>baseName</code>, <code>locale</code>,
* <code>format</code>, <code>loader</code>, or
* <code>bundle</code> is <code>null</code>
*/
public boolean needsReload(String baseName, Locale locale,
*** 3435,3445 ****
* qualified class name
* @param locale
* the locale for which a resource bundle should be
* loaded
* @return the bundle name for the resource bundle
! * @exception NullPointerException
* if <code>baseName</code> or <code>locale</code>
* is <code>null</code>
* @see java.util.spi.AbstractResourceBundleProvider#toBundleName(String, Locale)
*/
public String toBundleName(String baseName, Locale locale) {
--- 3435,3445 ----
* qualified class name
* @param locale
* the locale for which a resource bundle should be
* loaded
* @return the bundle name for the resource bundle
! * @throws NullPointerException
* if <code>baseName</code> or <code>locale</code>
* is <code>null</code>
* @see java.util.spi.AbstractResourceBundleProvider#toBundleName(String, Locale)
*/
public String toBundleName(String baseName, Locale locale) {
*** 3493,3503 ****
* @param bundleName
* the bundle name
* @param suffix
* the file type suffix
* @return the converted resource name
! * @exception NullPointerException
* if {@code bundleName} or {@code suffix}
* is {@code null}
*/
public final String toResourceName(String bundleName, String suffix) {
StringBuilder sb = new StringBuilder(bundleName.length() + 1 + suffix.length());
--- 3493,3503 ----
* @param bundleName
* the bundle name
* @param suffix
* the file type suffix
* @return the converted resource name
! * @throws NullPointerException
* if {@code bundleName} or {@code suffix}
* is {@code null}
*/
public final String toResourceName(String bundleName, String suffix) {
StringBuilder sb = new StringBuilder(bundleName.length() + 1 + suffix.length());
< prev index next >