1947 if (keyword == null) {
1948 throw new IllegalArgumentException("keyword == null!");
1949 }
1950 int numListeners = warningListeners.size();
1951 for (int i = 0; i < numListeners; i++) {
1952 IIOWriteWarningListener listener =
1953 warningListeners.get(i);
1954 Locale locale = warningLocales.get(i);
1955 if (locale == null) {
1956 locale = Locale.getDefault();
1957 }
1958
1959 /**
1960 * If an applet supplies an implementation of ImageWriter and
1961 * resource bundles, then the resource bundle will need to be
1962 * accessed via the applet class loader. So first try the context
1963 * class loader to locate the resource bundle.
1964 * If that throws MissingResourceException, then try the
1965 * system class loader.
1966 */
1967 ClassLoader loader = (ClassLoader)
1968 java.security.AccessController.doPrivileged(
1969 new java.security.PrivilegedAction() {
1970 public Object run() {
1971 return Thread.currentThread().getContextClassLoader();
1972 }
1973 });
1974
1975 ResourceBundle bundle = null;
1976 try {
1977 bundle = ResourceBundle.getBundle(baseName, locale, loader);
1978 } catch (MissingResourceException mre) {
1979 try {
1980 bundle = ResourceBundle.getBundle(baseName, locale);
1981 } catch (MissingResourceException mre1) {
1982 throw new IllegalArgumentException("Bundle not found!");
1983 }
1984 }
1985
1986 String warning = null;
1987 try {
1988 warning = bundle.getString(keyword);
1989 } catch (ClassCastException cce) {
1990 throw new IllegalArgumentException("Resource is not a String!");
|
1947 if (keyword == null) {
1948 throw new IllegalArgumentException("keyword == null!");
1949 }
1950 int numListeners = warningListeners.size();
1951 for (int i = 0; i < numListeners; i++) {
1952 IIOWriteWarningListener listener =
1953 warningListeners.get(i);
1954 Locale locale = warningLocales.get(i);
1955 if (locale == null) {
1956 locale = Locale.getDefault();
1957 }
1958
1959 /**
1960 * If an applet supplies an implementation of ImageWriter and
1961 * resource bundles, then the resource bundle will need to be
1962 * accessed via the applet class loader. So first try the context
1963 * class loader to locate the resource bundle.
1964 * If that throws MissingResourceException, then try the
1965 * system class loader.
1966 */
1967 ClassLoader loader =
1968 java.security.AccessController.doPrivileged(
1969 new java.security.PrivilegedAction<ClassLoader>() {
1970 public ClassLoader run() {
1971 return Thread.currentThread().getContextClassLoader();
1972 }
1973 });
1974
1975 ResourceBundle bundle = null;
1976 try {
1977 bundle = ResourceBundle.getBundle(baseName, locale, loader);
1978 } catch (MissingResourceException mre) {
1979 try {
1980 bundle = ResourceBundle.getBundle(baseName, locale);
1981 } catch (MissingResourceException mre1) {
1982 throw new IllegalArgumentException("Bundle not found!");
1983 }
1984 }
1985
1986 String warning = null;
1987 try {
1988 warning = bundle.getString(keyword);
1989 } catch (ClassCastException cce) {
1990 throw new IllegalArgumentException("Resource is not a String!");
|