jaxws/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java
changeset 38822 8cc53e29c1d9
parent 25871 b80b84e87032
child 43852 93a527059d8a
equal deleted inserted replaced
38821:0de0f7caa840 38822:8cc53e29c1d9
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package com.sun.istack.internal.localization;
    26 package com.sun.istack.internal.localization;
    27 
    27 
       
    28 import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier;
    28 import java.text.MessageFormat;
    29 import java.text.MessageFormat;
    29 import java.util.HashMap;
    30 import java.util.HashMap;
    30 import java.util.Locale;
    31 import java.util.Locale;
    31 import java.util.MissingResourceException;
    32 import java.util.MissingResourceException;
    32 import java.util.ResourceBundle;
    33 import java.util.ResourceBundle;
    59         String key = l.getKey();
    60         String key = l.getKey();
    60         if (key == Localizable.NOT_LOCALIZABLE) {
    61         if (key == Localizable.NOT_LOCALIZABLE) {
    61             // this message is not localizable
    62             // this message is not localizable
    62             return (String) l.getArguments()[0];
    63             return (String) l.getArguments()[0];
    63         }
    64         }
       
    65 
    64         String bundlename = l.getResourceBundleName();
    66         String bundlename = l.getResourceBundleName();
    65 
    67 
    66         try {
    68         try {
    67             ResourceBundle bundle =
    69             ResourceBundle bundle =
    68                 (ResourceBundle) _resourceBundles.get(bundlename);
    70                 (ResourceBundle) _resourceBundles.get(bundlename);
       
    71 
       
    72             if (bundle == null) {
       
    73                 bundle = l.getResourceBundle(_locale);
       
    74                 if (bundle != null) {
       
    75                     _resourceBundles.put(bundlename, bundle);
       
    76                 }
       
    77             }
    69 
    78 
    70             if (bundle == null) {
    79             if (bundle == null) {
    71                 try {
    80                 try {
    72                     bundle = ResourceBundle.getBundle(bundlename, _locale);
    81                     bundle = ResourceBundle.getBundle(bundlename, _locale);
    73                 } catch (MissingResourceException e) {
    82                 } catch (MissingResourceException e) {
   149             }
   158             }
   150             sb.append(')');
   159             sb.append(')');
   151         }
   160         }
   152         return sb.toString();
   161         return sb.toString();
   153     }
   162     }
   154 
       
   155 }
   163 }