jdk/src/java.desktop/share/classes/javax/imageio/ImageReader.java
changeset 36511 9d0388c6b336
parent 35678 ad6cfe2f2e13
child 41121 91734a3ed04b
equal deleted inserted replaced
36510:043f1af70518 36511:9d0388c6b336
  2450             Locale locale = warningLocales.get(i);
  2450             Locale locale = warningLocales.get(i);
  2451             if (locale == null) {
  2451             if (locale == null) {
  2452                 locale = Locale.getDefault();
  2452                 locale = Locale.getDefault();
  2453             }
  2453             }
  2454 
  2454 
  2455             /**
  2455             /*
  2456              * If an applet supplies an implementation of ImageReader and
  2456              * Only the plugin knows the messages that are provided, so we
  2457              * resource bundles, then the resource bundle will need to be
  2457              * can always locate the resource bundles from the same loader
  2458              * accessed via the applet class loader. So first try the context
  2458              * as that for the plugin code itself.
  2459              * class loader to locate the resource bundle.
       
  2460              * If that throws MissingResourceException, then try the
       
  2461              * system class loader.
       
  2462              */
  2459              */
  2463             ClassLoader loader =
       
  2464                 java.security.AccessController.doPrivileged(
       
  2465                    new java.security.PrivilegedAction<ClassLoader>() {
       
  2466                       public ClassLoader run() {
       
  2467                         return Thread.currentThread().getContextClassLoader();
       
  2468                       }
       
  2469                 });
       
  2470 
       
  2471             ResourceBundle bundle = null;
  2460             ResourceBundle bundle = null;
  2472             try {
  2461             try {
  2473                 bundle = ResourceBundle.getBundle(baseName, locale, loader);
  2462                 bundle = ResourceBundle.getBundle(baseName, locale, this.getClass().getModule());
  2474             } catch (MissingResourceException mre) {
  2463             } catch (MissingResourceException mre) {
  2475                 try {
  2464                 throw new IllegalArgumentException("Bundle not found!");
  2476                     bundle = ResourceBundle.getBundle(baseName, locale);
       
  2477                 } catch (MissingResourceException mre1) {
       
  2478                     throw new IllegalArgumentException("Bundle not found!");
       
  2479                 }
       
  2480             }
  2465             }
  2481 
  2466 
  2482             String warning = null;
  2467             String warning = null;
  2483             try {
  2468             try {
  2484                 warning = bundle.getString(keyword);
  2469                 warning = bundle.getString(keyword);