private void InitKeysVector()
        {
            ResourceBundleWrapper current = this;

            keys = new List <String>();
            while (current != null)
            {
                IIterator <String> e = current.bundle.GetKeys();
                while (e.HasNext())
                {
                    String elem = (String)e.Next();
                    if (!keys.Contains(elem))
                    {
                        keys.Add(elem);
                    }
                }
                current = (ResourceBundleWrapper)current.GetParent();
            }
        }
        public override Object HandleGetObject(String key)
        {
            ResourceBundleWrapper current = this;
            Object obj = null;

            while (current != null)
            {
                try {
                    obj = current.bundle.GetObject(key);
                    break;
                } catch (MissingManifestResourceException ex) {
                    current = (ResourceBundleWrapper)current.GetParent();
                }
            }
            if (obj == null)
            {
                throw new MissingManifestResourceException("Can't find resource for bundle " + baseName + ", key "
                                                           + key);
            }
            return(obj);
        }
        protected static internal UResourceBundle InstantiateBundle(
            String baseName_0, String localeID_1, Assembly root,
            bool disableFallback)
        {
            if (root == null)
            {
                // we're on the bootstrap
                root = System.Reflection.Assembly.GetEntryAssembly();
            }
            Assembly cl_2          = root;
            String   name          = baseName_0;
            ULocale  defaultLocale = IBM.ICU.Util.ULocale.GetDefault();

            if (localeID_1.Length != 0)
            {
                name = name + "_" + localeID_1;
            }

            ResourceBundleWrapper b = (ResourceBundleWrapper)IBM.ICU.Util.UResourceBundle.LoadFromCache(cl_2,
                                                                                                        name, defaultLocale);

            if (b == null)
            {
                ResourceBundleWrapper parent = null;
                int i = localeID_1.LastIndexOf('_');

                if (i != -1)
                {
                    String locName = localeID_1.Substring(0, (i) - (0));
                    parent = (ResourceBundleWrapper)IBM.ICU.Util.UResourceBundle.LoadFromCache(cl_2, baseName_0
                                                                                               + "_" + locName, defaultLocale);
                    if (parent == null)
                    {
                        parent = (ResourceBundleWrapper)InstantiateBundle(
                            baseName_0, locName, cl_2, disableFallback);
                    }
                }
                else if (localeID_1.Length > 0)
                {
                    parent = (ResourceBundleWrapper)IBM.ICU.Util.UResourceBundle.LoadFromCache(cl_2, baseName_0,
                                                                                               defaultLocale);
                    if (parent == null)
                    {
                        parent = (ResourceBundleWrapper)InstantiateBundle(
                            baseName_0, "", cl_2, disableFallback);
                    }
                }
                try {
                    Type           cls = cl_2.GetType(name);
                    ResourceBundle bx  = (ResourceBundle)Activator.CreateInstance(cls);
                    b = new ResourceBundleWrapper(bx);
                    if (parent != null)
                    {
                        b.SetParent(parent);
                    }
                    b.baseName = baseName_0;
                    b.localeID = localeID_1;
                } catch (TypeLoadException e) {
                    String resName_3 = name.Replace('.', '/') + ".properties";
                    Stream stream    = (Stream) new ResourceBundleWrapper.Anonymous_C0(cl_2, resName_3).Run();
                    if (stream != null)
                    {
                        // make sure it is buffered
                        stream = new BufferedStream(stream);
                        try {
                            /*b = new ResourceBundleWrapper(
                             *      new PropertyResourceBundle(stream));*/
                            if (parent != null)
                            {
                                b.SetParent(parent);
                            }
                            b.baseName = baseName_0;
                            b.localeID = localeID_1;
                        } catch (Exception ex) {
                            // throw away exception
                        } finally {
                            try {
                                stream.Close();
                            } catch (Exception ex_4) {
                                // throw away exception
                            }
                        }
                    }

                    // if a bogus locale is passed then the parent should be
                    // the default locale not the root locale!
                    if (b == null)
                    {
                        String defaultName = defaultLocale.ToString();
                        if (localeID_1.Length > 0 && localeID_1.IndexOf('_') < 0 &&
                            defaultName.IndexOf(localeID_1) == -1)
                        {
                            b = (ResourceBundleWrapper)IBM.ICU.Util.UResourceBundle.LoadFromCache(cl_2, baseName_0
                                                                                                  + "_" + defaultName, defaultLocale);
                            if (b == null)
                            {
                                b = (ResourceBundleWrapper)InstantiateBundle(
                                    baseName_0, defaultName, cl_2, disableFallback);
                            }
                        }
                    }
                    // if still could not find the bundle then return the parent
                    if (b == null)
                    {
                        b = parent;
                    }
                } catch (Exception e_5) {
                    if (DEBUG)
                    {
                        System.Console.Out.WriteLine("failure");
                    }
                    if (DEBUG)
                    {
                        System.Console.Out.WriteLine(e_5);
                    }
                }

                IBM.ICU.Util.UResourceBundle.AddToCache(cl_2, name, defaultLocale, b);
            }
            if (b != null)
            {
                b.InitKeysVector();
            }
            else
            {
                if (DEBUG)
                {
                    System.Console.Out.WriteLine("Returning null for " + baseName_0 + "_"
                                                 + localeID_1);
                }
            }

            return(b);
        }