foundBundle = (ResourceBundle) rbClass.newInstance(); foundBundle.parent = bundle; foundBundle.locale = locale;
if (ResourceBundle.class.isAssignableFrom(rbClass)) bundle = (ResourceBundle) rbClass.newInstance();
  private static ResourceBundle tryBundle(String localizedName, Locale locale,                                                ClassLoader classloader,                                          ResourceBundle bundle, HashMap cache)  {    // First look into the cache.    if (cache.containsKey(localizedName))      {	Reference ref = (Reference) cache.get(localizedName);	// If REF is null, that means that we added a `null' value to	// the hash map.  That means we failed to find the bundle	// previously, and we cached that fact.  The JDK does this, so	// it must be ok.	if (ref == null)	  return null;	else	  {	    ResourceBundle rb = (ResourceBundle) ref.get();	    if (rb != null)	      {		// RB should already have the right parent, except if		// something very strange happened.		return rb;	      }	    // If RB is null, then we previously found it but it was	    // collected.  So we try again.	  }      }    // foundBundle holds exact matches for the localizedName resource    // bundle, which may later be cached.    ResourceBundle foundBundle = null;    try      {        Class rbClass;        if (classloader == null)          rbClass = Class.forName(localizedName);        else          rbClass = classloader.loadClass(localizedName);        foundBundle = (ResourceBundle) rbClass.newInstance();        foundBundle.parent = bundle;        foundBundle.locale = locale;      }    catch (Exception ex)      {        // ignore them all	foundBundle = null;      }    if (foundBundle == null)      {	try	  {	    InputStream is;	    final String resourceName	      = localizedName.replace('.', '/') + ".properties";	    if (classloader == null)	      is = ClassLoader.getSystemResourceAsStream(resourceName);	    else	      is = classloader.getResourceAsStream(resourceName);	    if (is != null)	      {		foundBundle = new PropertyResourceBundle(is);		foundBundle.parent = bundle;		foundBundle.locale = locale;	      }	  }	catch (IOException ex)	  {	  }      }    // Put the result into the hash table.  If we didn't find anything    // here, we record our parent bundle.  If we record `null' that means    // nothing, not even the base, was found.    if (foundBundle == null)      foundBundle = bundle;    if (foundBundle == null)      cache.put(localizedName, null);    else      cache.put(localizedName, new SoftReference(foundBundle));    return foundBundle;  }