[ecj] First VMStackWalker merges

Gary Benson gbenson@redhat.com
Wed Nov 29 12:45:00 GMT 2006


Hi all,

This commit removes the gcj-specific versions of java.lang.Package,
java.util.ResourceBundle and java.security.Security, which Andrew's
partial VMStackWalker implementation renders unnecessary.

Cheers,
Gary
-------------- next part --------------
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 119304)
+++ ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2006-11-29  Gary Benson  <gbenson@redhat.com>
+
+	* java/lang/Package.java: Removed.
+	* java/security/Security.java: Likewise.
+	* java/util/ResourceBundle.java: Likewise.
+	* java/util/natResourceBundle.cc: Likewise.
+	* Makefile.am (nat_source_files): Removed natResourceBundle.cc.
+	* sources.am, Makefile.in: Rebuilt.
+
 2006-11-29  Gary Benson  <gbenson@redhat.com>
 
 	* gnu/classpath/VMStackWalker.java: Added javadoc.
Index: java/lang/Package.java
===================================================================
--- java/lang/Package.java	(revision 119303)
+++ java/lang/Package.java	(working copy)
@@ -1,413 +0,0 @@
-/* Package.java -- information about a package
-   Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006
-   Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.lang;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.net.URL;
-import java.util.NoSuchElementException;
-import java.util.StringTokenizer;
-
-
-/**
- * Everything you ever wanted to know about a package. This class makes it
- * possible to attach specification and implementation information to a
- * package as explained in the
- * <a href="http://java.sun.com/products/jdk/1.3/docs/guide/versioning/spec/VersioningSpecification.html#PackageVersionSpecification">Package Versioning Specification</a>
- * section of the
- * <a href="http://java.sun.com/products/jdk/1.3/docs/guide/versioning/spec/VersioningSpecification.html">Product Versioning Specification</a>.
- * It also allows packages to be sealed with respect to the originating URL.
- *
- * <p>The most useful method is the <code>isCompatibleWith()</code> method that
- * compares a desired version of a specification with the version of the
- * specification as implemented by a package. A package is considered
- * compatible with another version if the version of the specification is
- * equal or higher then the requested version. Version numbers are represented
- * as strings of positive numbers separated by dots (e.g. "1.2.0").
- * The first number is called the major number, the second the minor,
- * the third the micro, etc. A version is considered higher then another
- * version if it has a bigger major number then the another version or when
- * the major numbers of the versions are equal if it has a bigger minor number
- * then the other version, etc. (If a version has no minor, micro, etc numbers
- * then they are considered the be 0.)
- *
- * @author Mark Wielaard (mark@klomp.org)
- * @see ClassLoader#definePackage(String, String, String, String, String,
- *      String, String, URL)
- * @since 1.2
- * @status updated to 1.5
- */
-public class Package
-  implements AnnotatedElement
-{
-  /** The name of the Package */
-  private final String name;
-
-  /** The name if the implementation */
-  private final String implTitle;
-
-  /** The vendor that wrote this implementation */
-  private final String implVendor;
-
-  /** The version of this implementation */
-  private final String implVersion;
-
-  /** The name of the specification */
-  private final String specTitle;
-
-  /** The name of the specification designer */
-  private final String specVendor;
-
-  /** The version of this specification */
-  private final String specVersion;
-
-  /** If sealed the origin of the package classes, otherwise null */
-  private final URL sealed;
-
-  /** The class loader that defined this package */
-  private ClassLoader loader;
-
-  /** @deprecated Please use the other constructor that takes the class loader
-   *              that defines the Package.
-   */
-  Package(String name,
-	  String specTitle, String specVendor, String specVersion,
-	  String implTitle, String implVendor, String implVersion, URL sealed)
-  {
-    this(name, specTitle, specVendor, specVersion, implTitle, implVendor,
-         implVersion, sealed, null);
-  }
-
-  /**
-   * A package local constructor for the Package class. All parameters except
-   * the <code>name</code> of the package may be <code>null</code>.
-   * There are no public constructors defined for Package; this is a package
-   * local constructor that is used by java.lang.Classloader.definePackage().
-   * 
-   * @param name The name of the Package
-   * @param specTitle The name of the specification
-   * @param specVendor The name of the specification designer
-   * @param specVersion The version of this specification
-   * @param implTitle The name of the implementation
-   * @param implVendor The vendor that wrote this implementation
-   * @param implVersion The version of this implementation
-   * @param sealed If sealed the origin of the package classes
-   */
-  Package(String name,
-	  String specTitle, String specVendor, String specVersion,
-	  String implTitle, String implVendor, String implVersion, URL sealed,
-          ClassLoader loader)
-  {
-    if (name == null)
-      throw new IllegalArgumentException("null Package name");
-
-    this.name = name;
-    this.implTitle = implTitle;
-    this.implVendor = implVendor;
-    this.implVersion = implVersion;
-    this.specTitle = specTitle;
-    this.specVendor = specVendor;
-    this.specVersion = specVersion;
-    this.sealed = sealed;
-    this.loader = loader;
-  }
-
-  /**
-   * Returns the Package name in dot-notation.
-   *
-   * @return the non-null package name
-   */
-  public String getName()
-  {
-    return name;
-  }
-
-  /**
-   * Returns the name of the specification, or null if unknown.
-   *
-   * @return the specification title
-   */
-  public String getSpecificationTitle()
-  {
-    return specTitle;
-  }
-
-  /**
-   * Returns the version of the specification, or null if unknown.
-   *
-   * @return the specification version
-   */
-  public String getSpecificationVersion()
-  {
-    return specVersion;
-  }
-
-  /**
-   * Returns the name of the specification designer, or null if unknown.
-   *
-   * @return the specification vendor
-   */
-  public String getSpecificationVendor()
-  {
-    return specVendor;
-  }
-
-  /**
-   * Returns the name of the implementation, or null if unknown.
-   *
-   * @return the implementation title
-   */
-  public String getImplementationTitle()
-  {
-    return implTitle;
-  }
-
-  /**
-   * Returns the version of this implementation, or null if unknown.
-   *
-   * @return the implementation version
-   */
-  public String getImplementationVersion()
-  {
-    return implVersion;
-  }
-
-  /**
-   * Returns the vendor that wrote this implementation, or null if unknown.
-   *
-   * @return the implementation vendor
-   */
-  public String getImplementationVendor()
-  {
-    return implVendor;
-  }
-
-  /**
-   * Returns true if this Package is sealed.
-   *
-   * @return true if the package is sealed
-   */
-  public boolean isSealed()
-  {
-    return sealed != null;
-  }
-
-  /**
-   * Returns true if this Package is sealed and the origin of the classes is
-   * the given URL.
-   *
-   * @param url the URL to test
-   * @return true if the package is sealed by this URL
-   * @throws NullPointerException if url is null
-   */
-  public boolean isSealed(URL url)
-  {
-    return url.equals(sealed);
-  }
-
-  /**
-   * Checks if the version of the specification is higher or at least as high
-   * as the desired version. Comparison is done by sequentially comparing
-   * dotted decimal numbers from the parameter and from
-   * <code>getSpecificationVersion</code>.
-   *
-   * @param version the (minimal) desired version of the specification
-   *
-   * @return true if the version is compatible, false otherwise
-   *
-   * @throws NumberFormatException if either version string is invalid
-   * @throws NullPointerException if either version string is null
-   */
-  public boolean isCompatibleWith(String version)
-  {
-    StringTokenizer versionTokens = new StringTokenizer(version, ".");
-    StringTokenizer specTokens = new StringTokenizer(specVersion, ".");
-    try
-      {
-        while (versionTokens.hasMoreElements())
-          {
-            int vers = Integer.parseInt(versionTokens.nextToken());
-            int spec = Integer.parseInt(specTokens.nextToken());
-            if (spec < vers)
-              return false;
-            else if (spec > vers)
-              return true;
-            // They must be equal, next Token please!
-          }
-      }
-    catch (NoSuchElementException e)
-      {
-        // This must have been thrown by spec.nextToken() so return false.
-        return false;
-      }
-    // They must have been exactly the same version.
-    // Or the specVersion has more subversions. That is also good.
-    return true;
-  }
-
-  /**
-   * Returns the named package if it is known by the callers class loader.
-   * It may return null if the package is unknown, when there is no
-   * information on that particular package available or when the callers
-   * classloader is null.
-   *
-   * @param name the name of the desired package
-   * @return the package by that name in the current ClassLoader
-   */
-  public static Package getPackage(String name)
-  {
-    // Get the caller's classloader
-    ClassLoader cl = VMSecurityManager.currentClassLoader(Package.class);
-    return cl != null ? cl.getPackage(name) : VMClassLoader.getPackage(name);
-  }
-
-  /**
-   * Returns all the packages that are known to the callers class loader.
-   * It may return an empty array if the classloader of the caller is null.
-   *
-   * @return an array of all known packages
-   */
-  public static Package[] getPackages()
-  {
-    // Get the caller's classloader
-    Class c = VMSecurityManager.getClassContext(Package.class)[1];
-    ClassLoader cl = c.getClassLoader();
-    return cl != null ? cl.getPackages() : VMClassLoader.getPackages();
-  }
-
-  /**
-   * Returns the hashCode of the name of this package.
-   *
-   * @return the hash code
-   */
-  public int hashCode()
-  {
-    return name.hashCode();
-  }
-
-  /**
-   * Returns a string representation of this package. It is specified to
-   * be <code>"package " + getName() + (getSpecificationTitle() == null
-   * ? "" : ", " + getSpecificationTitle()) + (getSpecificationVersion()
-   * == null ? "" : ", version " + getSpecificationVersion())</code>.
-   *
-   * @return the string representation of the package
-   */
-  public String toString()
-  {
-    return ("package " + name + (specTitle == null ? "" : ", " + specTitle)
-	    + (specVersion == null ? "" : ", version " + specVersion));
-  }
-
-  /**
-   * Returns this package's annotation for the specified annotation type,
-   * or <code>null</code> if no such annotation exists.
-   *
-   * @param annotationClass the type of annotation to look for.
-   * @return this package's annotation for the specified type, or
-   *         <code>null</code> if no such annotation exists.
-   * @since 1.5
-   */
-  public <A extends Annotation> A getAnnotation(Class<A> annotationClass)
-  {
-    A foundAnnotation = null;
-    Annotation[] annotations = getAnnotations();
-    for (Annotation annotation : annotations)
-      if (annotation.annotationType() == annotationClass)
-	foundAnnotation = (A) annotation;
-    return foundAnnotation;
-  }
-
-  /**
-   * Returns all annotations associated with this package.  If there are
-   * no annotations associated with this package, then a zero-length array
-   * will be returned.  The returned array may be modified by the client
-   * code, but this will have no effect on the annotation content of this
-   * package, and hence no effect on the return value of this method for
-   * future callers.
-   *
-   * @return this package' annotations.
-   * @since 1.5
-   */
-  public Annotation[] getAnnotations()
-  {
-    /** All a package's annotations are declared within it. */
-    return getDeclaredAnnotations();
-  }
-
-  /**
-   * Returns all annotations directly defined by this package.  If there are
-   * no annotations associated with this package, then a zero-length array
-   * will be returned.  The returned array may be modified by the client
-   * code, but this will have no effect on the annotation content of this
-   * package, and hence no effect on the return value of this method for
-   * future callers.
-   *
-   * @return the annotations directly defined by this package.
-   * @since 1.5
-   */
-  public Annotation[] getDeclaredAnnotations()
-  {
-    try
-      {
-        Class pkgInfo = Class.forName(name + ".package-info", false, loader);
-        return pkgInfo.getDeclaredAnnotations();
-      }
-    catch (ClassNotFoundException _)
-      {
-        return new Annotation[0];
-      }
-  }
-
-  /**
-   * Returns true if an annotation for the specified type is associated
-   * with this package.  This is primarily a short-hand for using marker
-   * annotations.
-   *
-   * @param annotationClass the type of annotation to look for.
-   * @return true if an annotation exists for the specified type.
-   * @since 1.5
-   */
-  public boolean isAnnotationPresent(Class<? extends Annotation> 
-				     annotationClass)
-  {
-    return getAnnotation(annotationClass) != null;
-  }
-
-} // class Package
Index: java/security/Security.java
===================================================================
--- java/security/Security.java	(revision 119303)
+++ java/security/Security.java	(working copy)
@@ -1,714 +0,0 @@
-/* Security.java --- Java base security class implementation
-   Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.security;
-
-import gnu.classpath.SystemProperties;
-
-import gnu.classpath.Configuration;
-// GCJ LOCAL - We don't have VMStackWalker yet.
-// import gnu.classpath.VMStackWalker;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.Vector;
-
-/**
- * This class centralizes all security properties and common security methods.
- * One of its primary uses is to manage security providers.
- *
- * @author Mark Benvenuto (ivymccough@worldnet.att.net)
- */
-public final class Security
-{
-  private static final String ALG_ALIAS = "Alg.Alias.";
-
-  private static Vector providers = new Vector();
-  private static Properties secprops = new Properties();
-  
-  static
-    {
-      String base = SystemProperties.getProperty("gnu.classpath.home.url");
-      String vendor = SystemProperties.getProperty("gnu.classpath.vm.shortname");
-
-      // Try VM specific security file
-      boolean loaded = loadProviders (base, vendor);
-    
-      // Append classpath standard provider if possible
-      if (!loadProviders (base, "classpath")
-	  && !loaded
-	  && providers.size() == 0)
-	  {
-	      if (Configuration.DEBUG)
-		  {
-		      /* No providers found and both security files failed to
-		       * load properly. Give a warning in case of DEBUG is
-		       * enabled. Could be done with java.util.logging later.
-		       */
-		      System.err.println
-			  ("WARNING: could not properly read security provider files:");
-		      System.err.println
-			  ("         " + base + "/security/" + vendor
-			   + ".security");
-		      System.err.println
-			  ("         " + base + "/security/" + "classpath"
-			   + ".security");
-		      System.err.println
-			  ("         Falling back to standard GNU security provider");
-		  }
-              // Note that this matches our classpath.security file.
-	      providers.addElement (new gnu.java.security.provider.Gnu());
-	      providers.addElement(new gnu.javax.crypto.jce.GnuCrypto());
-              providers.addElement(new gnu.javax.crypto.jce.GnuSasl());
-              providers.addElement(new gnu.javax.net.ssl.provider.Jessie());
-              providers.addElement(new gnu.javax.security.auth.callback.GnuCallbacks());
-	  }
-    }
-  // This class can't be instantiated.
-  private Security()
-  {
-  }
-
-  /**
-   * Tries to load the vender specific security providers from the given base
-   * URL. Returns true if the resource could be read and completely parsed
-   * successfully, false otherwise.
-   */
-  private static boolean loadProviders(String baseUrl, String vendor)
-  {
-    if (baseUrl == null || vendor == null)
-      return false;
-
-    boolean result = true;
-    String secfilestr = baseUrl + "/security/" + vendor + ".security";
-    try
-      {
-	InputStream fin = new URL(secfilestr).openStream();
-	secprops.load(fin);
-
-	int i = 1;
-	String name;
-	while ((name = secprops.getProperty("security.provider." + i)) != null)
-	  {
-	    Exception exception = null;
-	    try
-	      {
-		ClassLoader sys = ClassLoader.getSystemClassLoader();
-		providers.addElement(Class.forName(name, true, sys).newInstance());
-	      }
-	    catch (ClassNotFoundException x)
-	      {
-	        exception = x;
-	      }
-	    catch (InstantiationException x)
-	      {
-	        exception = x;
-	      }
-	    catch (IllegalAccessException x)
-	      {
-	        exception = x;
-	      }
-
-	    if (exception != null)
-	      {
-		System.err.println ("WARNING: Error loading security provider "
-				    + name + ": " + exception);
-		result = false;
-	      }
-	    i++;
-	  }
-      }
-    catch (IOException ignored)
-      {
-	result = false;
-      }
-
-    return result;
-  }
-
-  /**
-   * Returns the value associated to a designated property name for a given
-   * algorithm.
-   * 
-   * @param algName
-   *          the algorithm name.
-   * @param propName
-   *          the name of the property to return.
-   * @return the value of the specified property or <code>null</code> if none
-   *         found.
-   * @deprecated Use the provider-based and algorithm-independent
-   *             {@link AlgorithmParameters} and {@link KeyFactory} engine
-   *             classes instead.
-   */
-  public static String getAlgorithmProperty(String algName, String propName)
-  {
-    if (algName == null || propName == null)
-      return null;
-
-    String property = String.valueOf(propName) + "." + String.valueOf(algName);
-    Provider p;
-    for (Iterator i = providers.iterator(); i.hasNext(); )
-      {
-        p = (Provider) i.next();
-        for (Iterator j = p.keySet().iterator(); j.hasNext(); )
-          {
-            String key = (String) j.next();
-            if (key.equalsIgnoreCase(property))
-              return p.getProperty(key);
-          }
-      }
-    return null;
-  }
-
-  /**
-   * Inserts a new designated {@link Provider} at a designated (1-based)
-   * position in the current list of installed {@link Provider}s,
-   * 
-   * @param provider
-   *          the new {@link Provider} to add.
-   * @param position
-   *          the position (starting from 1) of where to install
-   *          <code>provider</code>.
-   * @return the actual position, in the list of installed Providers. Returns
-   *         <code>-1</code> if <code>provider</code> was laready in the
-   *         list. The actual position may be different than the desired
-   *         <code>position</code>.
-   * @throws SecurityException
-   *           if a {@link SecurityManager} is installed and it disallows this
-   *           operation.
-   * @see #getProvider(String)
-   * @see #removeProvider(String)
-   * @see SecurityPermission
-   */
-  public static int insertProviderAt(Provider provider, int position)
-  {
-    SecurityManager sm = System.getSecurityManager();
-    if (sm != null)
-      sm.checkSecurityAccess("insertProvider." + provider.getName());
-
-    position--;
-    int max = providers.size ();
-    for (int i = 0; i < max; i++)
-      {
-	if (((Provider) providers.elementAt(i)).getName().equals(provider.getName()))
-	  return -1;
-      }
-
-    if (position < 0)
-      position = 0;
-    if (position > max)
-      position = max;
-
-    providers.insertElementAt(provider, position);
-
-    return position + 1;
-  }
-
-  /**
-   * Appends the designated new {@link Provider} to the current list of
-   * installed {@link Provider}s.
-   * 
-   * @param provider
-   *          the new {@link Provider} to append.
-   * @return the position (starting from 1) of <code>provider</code> in the
-   *         current list of {@link Provider}s, or <code>-1</code> if
-   *         <code>provider</code> was already there.
-   * @throws SecurityException
-   *           if a {@link SecurityManager} is installed and it disallows this
-   *           operation.
-   * @see #getProvider(String)
-   * @see #removeProvider(String)
-   * @see SecurityPermission
-   */
-  public static int addProvider(Provider provider)
-  {
-    return insertProviderAt (provider, providers.size () + 1);
-  }
-
-  /**
-   * Removes an already installed {@link Provider}, given its name, from the
-   * current list of installed {@link Provider}s.
-   * 
-   * @param name
-   *          the name of an already installed {@link Provider} to remove.
-   * @throws SecurityException
-   *           if a {@link SecurityManager} is installed and it disallows this
-   *           operation.
-   * @see #getProvider(String)
-   * @see #addProvider(Provider)
-   */
-  public static void removeProvider(String name)
-  {
-    SecurityManager sm = System.getSecurityManager();
-    if (sm != null)
-      sm.checkSecurityAccess("removeProvider." + name);
-
-    int max = providers.size ();
-    for (int i = 0; i < max; i++)
-      {
-	if (((Provider) providers.elementAt(i)).getName().equals(name))
-	  {
-	    providers.remove(i);
-	    break;
-	  }
-      }
-  }
-
-  /**
-   * Returns the current list of installed {@link Provider}s as an array
-   * ordered according to their installation preference order.
-   * 
-   * @return an array of all the installed providers.
-   */
-  public static Provider[] getProviders()
-  {
-    Provider[] array = new Provider[providers.size ()];
-    providers.copyInto (array);
-    return array;
-  }
-
-  /**
-   * Returns an already installed {@link Provider} given its name.
-   * 
-   * @param name
-   *          the name of an already installed {@link Provider}.
-   * @return the {@link Provider} known by <code>name</code>. Returns
-   *         <code>null</code> if the current list of {@link Provider}s does
-   *         not include one named <code>name</code>.
-   * @see #removeProvider(String)
-   * @see #addProvider(Provider)
-   */
-  public static Provider getProvider(String name)
-  {
-    if (name == null)
-      return null;
-    else
-      {
-        name = name.trim();
-        if (name.length() == 0)
-          return null;
-      }
-    Provider p;
-    int max = providers.size ();
-    for (int i = 0; i < max; i++)
-      {
-	p = (Provider) providers.elementAt(i);
-	if (p.getName().equals(name))
-	  return p;
-      }
-    return null;
-  }
-
-  /**
-   * Returns the value associated with a Security propery.
-   * 
-   * @param key
-   *          the key of the property to fetch.
-   * @return the value of the Security property associated with
-   *         <code>key</code>. Returns <code>null</code> if no such property
-   *         was found.
-   * @throws SecurityException
-   *           if a {@link SecurityManager} is installed and it disallows this
-   *           operation.
-   * @see #setProperty(String, String)
-   * @see SecurityPermission
-   */
-  public static String getProperty(String key)
-  {
-    // GCJ LOCAL - We don't have VMStackWalker yet.
-    // XXX To prevent infinite recursion when the SecurityManager calls us,
-    // don't do a security check if the caller is trusted (by virtue of having
-    // been loaded by the bootstrap class loader).
-    SecurityManager sm = System.getSecurityManager();
-    // if (sm != null && VMStackWalker.getCallingClassLoader() != null)
-    if (sm != null)
-      sm.checkSecurityAccess("getProperty." + key);
-
-    return secprops.getProperty(key);
-  }
-
-  /**
-   * Sets or changes a designated Security property to a designated value.
-   * 
-   * @param key
-   *          the name of the property to set.
-   * @param datum
-   *          the new value of the property.
-   * @throws SecurityException
-   *           if a {@link SecurityManager} is installed and it disallows this
-   *           operation.
-   * @see #getProperty(String)
-   * @see SecurityPermission
-   */
-  public static void setProperty(String key, String datum)
-  {
-    SecurityManager sm = System.getSecurityManager();
-    if (sm != null)
-      sm.checkSecurityAccess("setProperty." + key);
-
-    if (datum == null)
-      secprops.remove(key);
-    else
-      secprops.put(key, datum);
-  }
-
-  /**
-   * For a given <i>service</i> (e.g. Signature, MessageDigest, etc...) this
-   * method returns the {@link Set} of all available algorithm names (instances
-   * of {@link String}, from all currently installed {@link Provider}s.
-   * 
-   * @param serviceName
-   *          the case-insensitive name of a service (e.g. Signature,
-   *          MessageDigest, etc).
-   * @return a {@link Set} of {@link String}s containing the names of all
-   *         algorithm names provided by all of the currently installed
-   *         {@link Provider}s.
-   * @since 1.4
-   */
-  public static Set<String> getAlgorithms(String serviceName)
-  {
-    HashSet<String> result = new HashSet<String>();
-    if (serviceName == null || serviceName.length() == 0)
-      return result;
-
-    serviceName = serviceName.trim();
-    if (serviceName.length() == 0)
-      return result;
-
-    serviceName = serviceName.toUpperCase()+".";
-    Provider[] providers = getProviders();
-    int ndx;
-    for (int i = 0; i < providers.length; i++)
-      for (Enumeration e = providers[i].propertyNames(); e.hasMoreElements(); )
-        {
-          String service = ((String) e.nextElement()).trim();
-          if (service.toUpperCase().startsWith(serviceName))
-            {
-              service = service.substring(serviceName.length()).trim();
-              ndx = service.indexOf(' '); // get rid of attributes
-              if (ndx != -1)
-                service = service.substring(0, ndx);
-              result.add(service);
-            }
-        }
-    return Collections.unmodifiableSet(result);
-  }
-
-  /**
-   * Returns an array of currently installed {@link Provider}s, ordered
-   * according to their installation preference order, which satisfy a given
-   * <i>selection</i> criterion.
-   * 
-   * <p>This implementation recognizes a <i>selection</i> criterion written in
-   * one of two following forms:</p>
-   * 
-   * <ul>
-   *   <li><crypto_service>.<algorithm_or_type>: Where
-   *   <i>crypto_service</i> is a case-insensitive string, similar to what has
-   *   been described in the {@link #getAlgorithms(String)} method, and
-   *   <i>algorithm_or_type</i> is a known case-insensitive name of an
-   *   Algorithm, or one of its aliases.
-   *   
-   *   <p>For example, "CertificateFactory.X.509" would return all the installed
-   *   {@link Provider}s which provide a <i>CertificateFactory</i>
-   *   implementation of <i>X.509</i>.</p></li>
-   *   
-   *   <li><crypto_service>.<algorithm_or_type> <attribute_name>:<value>:
-   *   Where <i>crypto_service</i> is a case-insensitive string, similar to what
-   *   has been described in the {@link #getAlgorithms(String)} method,
-   *   <i>algorithm_or_type</i> is a case-insensitive known name of an Algorithm
-   *   or one of its aliases, <i>attribute_name</i> is a case-insensitive
-   *   property name with no whitespace characters, and no dots, in-between, and
-   *   <i>value</i> is a {@link String} with no whitespace characters in-between.
-   *   
-   *   <p>For example, "Signature.Sha1WithDSS KeySize:1024" would return all the
-   *   installed {@link Provider}s which declared their ability to provide
-   *   <i>Signature</i> services, using the <i>Sha1WithDSS</i> algorithm with
-   *   key sizes of <i>1024</i>.</p></li>
-   * </ul>
-   * 
-   * @param filter
-   *          the <i>selection</i> criterion for selecting among the installed
-   *          {@link Provider}s.
-   * @return all the installed {@link Provider}s which satisfy the <i>selection</i>
-   *         criterion. Returns <code>null</code> if no installed
-   *         {@link Provider}s were found which satisfy the <i>selection</i>
-   *         criterion. Returns ALL installed {@link Provider}s if
-   *         <code>filter</code> is <code>null</code> or is an empty string.
-   * @throws InvalidParameterException
-   *           if an exception occurs while parsing the <code>filter</code>.
-   * @see #getProviders(Map)
-   */
-  public static Provider[] getProviders(String filter)
-  {
-    if (providers == null || providers.isEmpty())
-      return null;
-
-    if (filter == null || filter.length() == 0)
-      return getProviders();
-
-    HashMap map = new HashMap(1);
-    int i = filter.indexOf(':');
-    if (i == -1) // <service>.<algorithm>
-      map.put(filter, "");
-    else // <service>.<algorithm> <attribute>:<value>
-      map.put(filter.substring(0, i), filter.substring(i+1));
-
-    return getProviders(map);
-  }
-
-  /**
-   * Returns an array of currently installed {@link Provider}s which satisfy a
-   * set of <i>selection</i> criteria.
-   * 
-   * <p>The <i>selection</i> criteria are defined in a {@link Map} where each
-   * element specifies a <i>selection</i> querry. The <i>Keys</i> in this
-   * {@link Map} must be in one of the two following forms:</p>
-   * 
-   * <ul>
-   *   <li><crypto_service>.<algorithm_or_type>: Where
-   *   <i>crypto_service</i> is a case-insensitive string, similar to what has
-   *   been described in the {@link #getAlgorithms(String)} method, and
-   *   <i>algorithm_or_type</i> is a case-insensitive known name of an
-   *   Algorithm, or one of its aliases. The <i>value</i> of the entry in the
-   *   {@link Map} for such a <i>Key</i> MUST be the empty string.
-   *   {@link Provider}s which provide an implementation for the designated
-   *   <i>service algorithm</i> are included in the result.</li>
-   *   
-   *   <li><crypto_service>.<algorithm_or_type> <attribute_name>:
-   *   Where <i>crypto_service</i> is a case-insensitive string, similar to what
-   *   has been described in the {@link #getAlgorithms(String)} method,
-   *   <i>algorithm_or_type</i> is a case-insensitive known name of an Algorithm
-   *   or one of its aliases, and <i>attribute_name</i> is a case-insensitive
-   *   property name with no whitespace characters, and no dots, in-between. The
-   *   <i>value</i> of the entry in this {@link Map} for such a <i>Key</i> MUST
-   *   NOT be <code>null</code> or an empty string. {@link Provider}s which
-   *   declare the designated <i>attribute_name</i> and <i>value</i> for the
-   *   designated <i>service algorithm</i> are included in the result.</li>
-   * </ul>
-   * 
-   * @param filter
-   *          a {@link Map} of <i>selection querries</i>.
-   * @return all currently installed {@link Provider}s which satisfy ALL the
-   *         <i>selection</i> criteria defined in <code>filter</code>.
-   *         Returns ALL installed {@link Provider}s if <code>filter</code>
-   *         is <code>null</code> or empty.
-   * @throws InvalidParameterException
-   *           if an exception is encountered while parsing the syntax of the
-   *           {@link Map}'s <i>keys</i>.
-   * @see #getProviders(String)
-   */
-  public static Provider[] getProviders(Map<String,String> filter)
-  {
-    if (providers == null || providers.isEmpty())
-      return null;
-
-    if (filter == null)
-      return getProviders();
-
-    Set<String> querries = filter.keySet();
-    if (querries == null || querries.isEmpty())
-      return getProviders();
-
-    LinkedHashSet result = new LinkedHashSet(providers); // assume all
-    int dot, ws;
-    String querry, service, algorithm, attribute, value;
-    LinkedHashSet serviceProviders = new LinkedHashSet(); // preserve insertion order
-    for (Iterator i = querries.iterator(); i.hasNext(); )
-      {
-        querry = (String) i.next();
-        if (querry == null) // all providers
-          continue;
-
-        querry = querry.trim();
-        if (querry.length() == 0) // all providers
-          continue;
-
-        dot = querry.indexOf('.');
-        if (dot == -1) // syntax error
-          throw new InvalidParameterException(
-              "missing dot in '" + String.valueOf(querry)+"'");
-
-        value = filter.get(querry);
-        // deconstruct querry into [service, algorithm, attribute]
-        if (value == null || value.trim().length() == 0) // <service>.<algorithm>
-          {
-            value = null;
-            attribute = null;
-            service = querry.substring(0, dot).trim();
-            algorithm = querry.substring(dot+1).trim();
-          }
-        else // <service>.<algorithm> <attribute>
-          {
-            ws = querry.indexOf(' ');
-            if (ws == -1)
-              throw new InvalidParameterException(
-                  "value (" + String.valueOf(value) +
-                  ") is not empty, but querry (" + String.valueOf(querry) +
-                  ") is missing at least one space character");
-            value = value.trim();
-            attribute = querry.substring(ws+1).trim();
-            // was the dot in the attribute?
-            if (attribute.indexOf('.') != -1)
-              throw new InvalidParameterException(
-                  "attribute_name (" + String.valueOf(attribute) +
-                  ") in querry (" + String.valueOf(querry) + ") contains a dot");
-
-            querry = querry.substring(0, ws).trim();
-            service = querry.substring(0, dot).trim();
-            algorithm = querry.substring(dot+1).trim();
-          }
-
-        // service and algorithm must not be empty
-        if (service.length() == 0)
-          throw new InvalidParameterException(
-              "<crypto_service> in querry (" + String.valueOf(querry) +
-              ") is empty");
-
-        if (algorithm.length() == 0)
-          throw new InvalidParameterException(
-              "<algorithm_or_type> in querry (" + String.valueOf(querry) +
-              ") is empty");
-
-        selectProviders(service, algorithm, attribute, value, result, serviceProviders);
-        result.retainAll(serviceProviders); // eval next retaining found providers
-        if (result.isEmpty()) // no point continuing
-          break;
-      }
-
-    if (result.isEmpty())
-      return null;
-
-    return (Provider[]) result.toArray(new Provider[result.size()]);
-  }
-
-  private static void selectProviders(String svc, String algo, String attr,
-                                      String val, LinkedHashSet providerSet,
-                                      LinkedHashSet result)
-  {
-    result.clear(); // ensure we start with an empty result set
-    for (Iterator i = providerSet.iterator(); i.hasNext(); )
-      {
-        Provider p = (Provider) i.next();
-        if (provides(p, svc, algo, attr, val))
-          result.add(p);
-      }
-  }
-
-  private static boolean provides(Provider p, String svc, String algo,
-                                  String attr, String val)
-  {
-    Iterator it;
-    String serviceDotAlgorithm = null;
-    String key = null;
-    String realVal;
-    boolean found = false;
-    // if <svc>.<algo> <attr> is in the set then so is <svc>.<algo>
-    // but it may be stored under an alias <algo>. resolve
-    outer: for (int r = 0; r < 3; r++) // guard against circularity
-      {
-        serviceDotAlgorithm = (svc+"."+String.valueOf(algo)).trim();
-        for (it = p.keySet().iterator(); it.hasNext(); )
-          {
-            key = (String) it.next();
-            if (key.equalsIgnoreCase(serviceDotAlgorithm)) // eureka
-              {
-                found = true;
-                break outer;
-              }
-            // it may be there but as an alias
-            if (key.equalsIgnoreCase(ALG_ALIAS + serviceDotAlgorithm))
-              {
-                algo = p.getProperty(key);
-                continue outer;
-              }
-            // else continue inner
-          }
-      }
-
-    if (!found)
-      return false;
-
-    // found a candidate for the querry.  do we have an attr to match?
-    if (val == null) // <service>.<algorithm> querry
-      return true;
-
-    // <service>.<algorithm> <attribute>; find the key entry that match
-    String realAttr;
-    int limit = serviceDotAlgorithm.length() + 1;
-    for (it = p.keySet().iterator(); it.hasNext(); )
-      {
-        key = (String) it.next();
-        if (key.length() <= limit)
-          continue;
-
-        if (key.substring(0, limit).equalsIgnoreCase(serviceDotAlgorithm+" "))
-          {
-            realAttr = key.substring(limit).trim();
-            if (! realAttr.equalsIgnoreCase(attr))
-              continue;
-
-            // eveything matches so far.  do the value
-            realVal = p.getProperty(key);
-            if (realVal == null)
-              return false;
-
-            realVal = realVal.trim();
-            // is it a string value?
-            if (val.equalsIgnoreCase(realVal))
-              return true;
-
-            // assume value is a number. cehck for greater-than-or-equal
-            return (new Integer(val).intValue() >= new Integer(realVal).intValue());
-          }
-      }
-
-    return false;
-  }
-}
Index: java/util/ResourceBundle.java
===================================================================
--- java/util/ResourceBundle.java	(revision 119303)
+++ java/util/ResourceBundle.java	(working copy)
@@ -1,580 +0,0 @@
-/* ResourceBundle -- aids in loading resource bundles
-   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005
-   Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING.  If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library.  Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module.  An independent module is a module which is not derived from
-or based on this library.  If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so.  If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * A resource bundle contains locale-specific data. If you need localized
- * data, you can load a resource bundle that matches the locale with
- * <code>getBundle</code>. Now you can get your object by calling
- * <code>getObject</code> or <code>getString</code> on that bundle.
- *
- * <p>When a bundle is demanded for a specific locale, the ResourceBundle
- * is searched in following order (<i>def. language</i> stands for the
- * two letter ISO language code of the default locale (see
- * <code>Locale.getDefault()</code>).
- *
-<pre>baseName_<i>language code</i>_<i>country code</i>_<i>variant</i>
-baseName_<i>language code</i>_<i>country code</i>
-baseName_<i>language code</i>
-baseName_<i>def. language</i>_<i>def. country</i>_<i>def. variant</i>
-baseName_<i>def. language</i>_<i>def. country</i>
-baseName_<i>def. language</i>
-baseName</pre>
- *
- * <p>A bundle is backed up by less specific bundles (omitting variant, country
- * or language). But it is not backed up by the default language locale.
- *
- * <p>If you provide a bundle for a given locale, say
- * <code>Bundle_en_UK_POSIX</code>, you must also provide a bundle for
- * all sub locales, ie. <code>Bundle_en_UK</code>, <code>Bundle_en</code>, and
- * <code>Bundle</code>.
- *
- * <p>When a bundle is searched, we look first for a class with the given
- * name, then for a file with <code>.properties</code> extension in the
- * classpath. The name must be a fully qualified classname (with dots as
- * path separators).
- *
- * <p>(Note: This implementation always backs up the class with a properties
- * file if that is existing, but you shouldn't rely on this, if you want to
- * be compatible to the standard JDK.)
- *
- * @author Jochen Hoenicke
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Locale
- * @see ListResourceBundle
- * @see PropertyResourceBundle
- * @since 1.1
- * @status updated to 1.4
- */
-public abstract class ResourceBundle
-{
-  /**
-   * The parent bundle. This is consulted when you call getObject and there
-   * is no such resource in the current bundle. This field may be null.
-   */
-  protected ResourceBundle parent;
-
-  /**
-   * The locale of this resource bundle. You can read this with
-   * <code>getLocale</code> and it is automatically set in
-   * <code>getBundle</code>.
-   */
-  private Locale locale;
-
-  private static native ClassLoader getCallingClassLoader();
-
-  /**
-   * The resource bundle cache.
-   */
-  private static Map bundleCache;
-
-  /**
-   * The last default Locale we saw. If this ever changes then we have to
-   * reset our caches.
-   */
-  private static Locale lastDefaultLocale;
-
-  /**
-   * The `empty' locale is created once in order to optimize
-   * tryBundle().
-   */
-  private static final Locale emptyLocale = new Locale("");
-
-  /**
-   * The constructor. It does nothing special.
-   */
-  public ResourceBundle()
-  {
-  }
-
-  /**
-   * Get a String from this resource bundle. Since most localized Objects
-   * are Strings, this method provides a convenient way to get them without
-   * casting.
-   *
-   * @param key the name of the resource
-   * @throws MissingResourceException if the resource can't be found
-   * @throws NullPointerException if key is null
-   * @throws ClassCastException if resource is not a string
-   */
-  public final String getString(String key)
-  {
-    return (String) getObject(key);
-  }
-
-  /**
-   * Get an array of Strings from this resource bundle. This method
-   * provides a convenient way to get it without casting.
-   *
-   * @param key the name of the resource
-   * @throws MissingResourceException if the resource can't be found
-   * @throws NullPointerException if key is null
-   * @throws ClassCastException if resource is not a string
-   */
-  public final String[] getStringArray(String key)
-  {
-    return (String[]) getObject(key);
-  }
-
-  /**
-   * Get an object from this resource bundle. This will call
-   * <code>handleGetObject</code> for this resource and all of its parents,
-   * until it finds a non-null resource.
-   *
-   * @param key the name of the resource
-   * @throws MissingResourceException if the resource can't be found
-   * @throws NullPointerException if key is null
-   */
-  public final Object getObject(String key)
-  {
-    for (ResourceBundle bundle = this; bundle != null; bundle = bundle.parent)
-      {
-        Object o = bundle.handleGetObject(key);
-        if (o != null)
-          return o;
-      }
-
-    String className = getClass().getName();
-    throw new MissingResourceException("Key '" + key
-				       + "'not found in Bundle: "
-				       + className, className, key);
-  }
-
-  /**
-   * Return the actual locale of this bundle. You can use it after calling
-   * getBundle, to know if the bundle for the desired locale was loaded or
-   * if the fall back was used.
-   *
-   * @return the bundle's locale
-   */
-  public Locale getLocale()
-  {
-    return locale;
-  }
-
-  /**
-   * Set the parent of this bundle. The parent is consulted when you call
-   * getObject and there is no such resource in the current bundle.
-   *
-   * @param parent the parent of this bundle
-   */
-  protected void setParent(ResourceBundle parent)
-  {
-    this.parent = parent;
-  }
-
-  /**
-   * Get the appropriate ResourceBundle for the default locale. This is like
-   * calling <code>getBundle(baseName, Locale.getDefault(),
-   * getClass().getClassLoader()</code>, except that any security check of
-   * getClassLoader won't fail.
-   *
-   * @param baseName the name of the ResourceBundle
-   * @return the desired resource bundle
-   * @throws MissingResourceException if the resource bundle can't be found
-   * @throws NullPointerException if baseName is null
-   */
-  public static ResourceBundle getBundle(String baseName)
-  {
-    ClassLoader cl = getCallingClassLoader();
-    if (cl == null)
-      cl = ClassLoader.getSystemClassLoader();
-    return getBundle(baseName, Locale.getDefault(), cl);
-  }
-
-  /**
-   * Get the appropriate ResourceBundle for the given locale. This is like
-   * calling <code>getBundle(baseName, locale,
-   * getClass().getClassLoader()</code>, except that any security check of
-   * getClassLoader won't fail.
-   *
-   * @param baseName the name of the ResourceBundle
-   * @param locale A locale
-   * @return the desired resource bundle
-   * @throws MissingResourceException if the resource bundle can't be found
-   * @throws NullPointerException if baseName or locale is null
-   */
-  public static ResourceBundle getBundle(String baseName, Locale locale)
-  {
-    ClassLoader cl = getCallingClassLoader();
-    if (cl == null)
-      cl = ClassLoader.getSystemClassLoader();
-    return getBundle(baseName, locale, cl);
-  }
-
-  /** Cache key for the ResourceBundle cache.  Resource bundles are keyed
-      by the combination of bundle name, locale, and class loader. */
-  private static class BundleKey
-  {
-    String baseName;
-    Locale locale;
-    ClassLoader classLoader;
-    int hashcode;
-
-    BundleKey() {}
-
-    BundleKey(String s, Locale l, ClassLoader cl)
-    {
-      set(s, l, cl);
-    }
-    
-    void set(String s, Locale l, ClassLoader cl)
-    {
-      baseName = s;
-      locale = l;
-      classLoader = cl;
-      hashcode = baseName.hashCode() ^ locale.hashCode() ^
-        classLoader.hashCode();
-    }
-    
-    public int hashCode()
-    {
-      return hashcode;
-    }
-    
-    public boolean equals(Object o)
-    {
-      if (! (o instanceof BundleKey))
-        return false;
-      BundleKey key = (BundleKey) o;
-      return hashcode == key.hashcode &&
-	baseName.equals(key.baseName) &&
-        locale.equals(key.locale) &&
-	classLoader.equals(key.classLoader);
-    }    
-  }
-  
-  /** A cache lookup key. This avoids having to a new one for every
-   *  getBundle() call. */
-  private static BundleKey lookupKey = new BundleKey();
-  
-  /** Singleton cache entry to represent previous failed lookups. */
-  private static Object nullEntry = new Object();
-
-  /**
-   * Get the appropriate ResourceBundle for the given locale. The following
-   * strategy is used:
-   *
-   * <p>A sequence of candidate bundle names are generated, and tested in
-   * this order, where the suffix 1 means the string from the specified
-   * locale, and the suffix 2 means the string from the default locale:</p>
-   *
-   * <ul>
-   * <li>baseName + "_" + language1 + "_" + country1 + "_" + variant1</li>
-   * <li>baseName + "_" + language1 + "_" + country1</li>
-   * <li>baseName + "_" + language1</li>
-   * <li>baseName + "_" + language2 + "_" + country2 + "_" + variant2</li>
-   * <li>baseName + "_" + language2 + "_" + country2</li>
-   * <li>baseName + "_" + language2</li>
-   * <li>baseName</li>
-   * </ul>
-   *
-   * <p>In the sequence, entries with an empty string are ignored. Next,
-   * <code>getBundle</code> tries to instantiate the resource bundle:</p>
-   *
-   * <ul>
-   * <li>First, an attempt is made to load a class in the specified classloader
-   * which is a subclass of ResourceBundle, and which has a public constructor
-   * with no arguments, via reflection.</li>
-   * <li>Next, a search is made for a property resource file, by replacing
-   * '.' with '/' and appending ".properties", and using
-   * ClassLoader.getResource(). If a file is found, then a
-   * PropertyResourceBundle is created from the file's contents.</li>
-   * </ul>
-   * If no resource bundle was found, a MissingResourceException is thrown.
-   *
-   * <p>Next, the parent chain is implemented. The remaining candidate names
-   * in the above sequence are tested in a similar manner, and if any results
-   * in a resource bundle, it is assigned as the parent of the first bundle
-   * using the <code>setParent</code> method (unless the first bundle already
-   * has a parent).</p>
-   *
-   * <p>For example, suppose the following class and property files are
-   * provided: MyResources.class, MyResources_fr_CH.properties,
-   * MyResources_fr_CH.class, MyResources_fr.properties,
-   * MyResources_en.properties, and MyResources_es_ES.class. The contents of
-   * all files are valid (that is, public non-abstract subclasses of
-   * ResourceBundle with public nullary constructors for the ".class" files,
-   * syntactically correct ".properties" files). The default locale is
-   * Locale("en", "UK").</p>
-   *
-   * <p>Calling getBundle with the shown locale argument values instantiates
-   * resource bundles from the following sources:</p>
-   *
-   * <ul>
-   * <li>Locale("fr", "CH"): result MyResources_fr_CH.class, parent
-   *   MyResources_fr.properties, parent MyResources.class</li>
-   * <li>Locale("fr", "FR"): result MyResources_fr.properties, parent
-   *   MyResources.class</li>
-   * <li>Locale("de", "DE"): result MyResources_en.properties, parent
-   *   MyResources.class</li>
-   * <li>Locale("en", "US"): result MyResources_en.properties, parent
-   *   MyResources.class</li>
-   * <li>Locale("es", "ES"): result MyResources_es_ES.class, parent
-   *   MyResources.class</li>
-   * </ul>
-   * 
-   * <p>The file MyResources_fr_CH.properties is never used because it is hidden
-   * by MyResources_fr_CH.class.</p>
-   *
-   * @param baseName the name of the ResourceBundle
-   * @param locale A locale
-   * @param classLoader a ClassLoader
-   * @return the desired resource bundle
-   * @throws MissingResourceException if the resource bundle can't be found
-   * @throws NullPointerException if any argument is null
-   * @since 1.2
-   */
-  // This method is synchronized so that the cache is properly
-  // handled.
-  public static synchronized ResourceBundle getBundle
-    (String baseName, Locale locale, ClassLoader classLoader)
-  {
-    // If the default locale changed since the last time we were called,
-    // all cache entries are invalidated.
-    Locale defaultLocale = Locale.getDefault();
-    if (defaultLocale != lastDefaultLocale)
-      {
-	bundleCache = new HashMap();
-	lastDefaultLocale = defaultLocale;
-      }
-
-    // This will throw NullPointerException if any arguments are null.
-    lookupKey.set(baseName, locale, classLoader);
-    
-    Object obj = bundleCache.get(lookupKey);
-    ResourceBundle rb = null;
-    
-    if (obj instanceof ResourceBundle)
-      {
-        return (ResourceBundle) obj;
-      }
-    else if (obj == nullEntry)
-      {
-        // Lookup has failed previously. Fall through.
-      }
-    else
-      {
-	// First, look for a bundle for the specified locale. We don't want
-	// the base bundle this time.
-	boolean wantBase = locale.equals(defaultLocale);
-	ResourceBundle bundle = tryBundle(baseName, locale, classLoader, 
-					  wantBase);
-
-        // Try the default locale if neccessary.
-	if (bundle == null && !locale.equals(defaultLocale))
-	  bundle = tryBundle(baseName, defaultLocale, classLoader, true);
-
-	BundleKey key = new BundleKey(baseName, locale, classLoader);
-        if (bundle == null)
-	  {
-	    // Cache the fact that this lookup has previously failed.
-	    bundleCache.put(key, nullEntry);
-	  }
-	else
-	  {
-            // Cache the result and return it.
-	    bundleCache.put(key, bundle);
-	    return bundle;
-	  }
-      }
-
-    throw new MissingResourceException("Bundle " + baseName + " not found",
-				       baseName, "");
-  }
-
-  /**
-   * Override this method to provide the resource for a keys. This gets
-   * called by <code>getObject</code>. If you don't have a resource
-   * for the given key, you should return null instead throwing a
-   * MissingResourceException. You don't have to ask the parent, getObject()
-   * already does this; nor should you throw a MissingResourceException.
-   *
-   * @param key the key of the resource
-   * @return the resource for the key, or null if not in bundle
-   * @throws NullPointerException if key is null
-   */
-  protected abstract Object handleGetObject(String key);
-
-  /**
-   * This method should return all keys for which a resource exists; you
-   * should include the enumeration of any parent's keys, after filtering out
-   * duplicates.
-   *
-   * @return an enumeration of the keys
-   */
-  public abstract Enumeration getKeys();
-
-  /**
-   * Tries to load a class or a property file with the specified name.
-   *
-   * @param localizedName the name
-   * @param classloader the classloader
-   * @return the resource bundle if it was loaded, otherwise the backup
-   */
-  private static ResourceBundle tryBundle(String localizedName,
-                                          ClassLoader classloader)
-  {
-    ResourceBundle bundle = null;
-    try
-      {
-        Class rbClass;
-        if (classloader == null)
-          rbClass = Class.forName(localizedName);
-        else
-          rbClass = classloader.loadClass(localizedName);
-	// Note that we do the check up front instead of catching
-	// ClassCastException.  The reason for this is that some crazy
-	// programs (Eclipse) have classes that do not extend
-	// ResourceBundle but that have the same name as a property
-	// bundle; in fact Eclipse relies on ResourceBundle not
-	// instantiating these classes.
-	if (ResourceBundle.class.isAssignableFrom(rbClass))
-	  bundle = (ResourceBundle) rbClass.newInstance();
-      }
-    catch (IllegalAccessException ex) {}
-    catch (InstantiationException ex) {}
-    catch (ClassNotFoundException ex) {}
-
-    if (bundle == null)
-      {
-	try
-	  {
-	    InputStream is;
-	    String resourceName
-	      = localizedName.replace('.', '/') + ".properties";
-	    if (classloader == null)
-	      is = ClassLoader.getSystemResourceAsStream(resourceName);
-	    else
-	      is = classloader.getResourceAsStream(resourceName);
-	    if (is != null)
-	      bundle = new PropertyResourceBundle(is);
-	  }
-	catch (IOException ex)
-	  {
-	    MissingResourceException mre = new MissingResourceException
-	      ("Failed to load bundle: " + localizedName, localizedName, "");
-	    mre.initCause(ex);
-	    throw mre;
-	  }
-      }
-
-    return bundle;
-  }
-
-  /**
-   * Tries to load a the bundle for a given locale, also loads the backup
-   * locales with the same language.
-   *
-   * @param baseName the raw bundle name, without locale qualifiers
-   * @param locale the locale
-   * @param classloader the classloader
-   * @param bundle the backup (parent) bundle
-   * @param wantBase whether a resource bundle made only from the base name
-   *        (with no locale information attached) should be returned.
-   * @return the resource bundle if it was loaded, otherwise the backup
-   */
-  private static ResourceBundle tryBundle(String baseName, Locale locale,
-                                          ClassLoader classLoader, 
-					  boolean wantBase)
-  {
-    String language = locale.getLanguage();
-    String country = locale.getCountry();
-    String variant = locale.getVariant();
-    
-    int baseLen = baseName.length();
-
-    // Build up a StringBuffer containing the complete bundle name, fully
-    // qualified by locale.
-    StringBuffer sb = new StringBuffer(baseLen + variant.length() + 7);
-
-    sb.append(baseName);
-    
-    if (language.length() > 0)
-      {
-	sb.append('_');
-	sb.append(language);
-	
-	if (country.length() > 0)
-	  {
-	    sb.append('_');
-	    sb.append(country);
-	    
-	    if (variant.length() > 0)
-	      {
-	        sb.append('_');
-		sb.append(variant);
-	      }
-	  }
-      }
-
-    // Now try to load bundles, starting with the most specialized name.
-    // Build up the parent chain as we go.
-    String bundleName = sb.toString();
-    ResourceBundle first = null; // The most specialized bundle.
-    ResourceBundle last = null; // The least specialized bundle.
-    
-    while (true)
-      {
-        ResourceBundle foundBundle = tryBundle(bundleName, classLoader);
-	if (foundBundle != null)
-	  {
-	    if (first == null)
-	      first = foundBundle;
-	    if (last != null)
-	      last.parent = foundBundle;
-	    foundBundle.locale = locale;
-	    last = foundBundle;
-	  }
-	int idx = bundleName.lastIndexOf('_');
-	// Try the non-localized base name only if we already have a
-	// localized child bundle, or wantBase is true.
-	if (idx > baseLen || (idx == baseLen && (first != null || wantBase)))
-	  bundleName = bundleName.substring(0, idx);
-	else
-	  break;
-      }
-    
-    return first;
-  }
-}
Index: java/util/natResourceBundle.cc
===================================================================
--- java/util/natResourceBundle.cc	(revision 119303)
+++ java/util/natResourceBundle.cc	(working copy)
@@ -1,29 +0,0 @@
-/* Copyright (C) 2002, 2003, 2005  Free Software Foundation
-
-   This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
-details.  */
-
-// Written by Tom Tromey <tromey@redhat.com>
-
-#include <config.h>
-
-#include <gcj/cni.h>
-#include <jvm.h>
-#include <java-stack.h>
-#include <java/util/ResourceBundle.h>
-#include <java/lang/ClassLoader.h>
-#include <java/lang/Class.h>
-
-using namespace java::lang;
-
-java::lang::ClassLoader *
-java::util::ResourceBundle::getCallingClassLoader ()
-{
-  jclass caller = _Jv_StackTrace::GetCallingClass (&ResourceBundle::class$);
-  if (caller)
-    return caller->getClassLoaderInternal();
-  return NULL;
-}
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 119303)
+++ Makefile.am	(working copy)
@@ -790,7 +790,6 @@
 java/security/natVMAccessController.cc \
 java/security/natVMAccessControlState.cc \
 java/text/natCollator.cc \
-java/util/natResourceBundle.cc \
 java/util/natVMTimeZone.cc \
 java/util/concurrent/atomic/natAtomicLong.cc \
 java/util/logging/natLogger.cc \
Index: sources.am
===================================================================
--- sources.am	(revision 119303)
+++ sources.am	(working copy)
@@ -4458,7 +4458,7 @@
 java/lang/Object.java \
 classpath/java/lang/OutOfMemoryError.java \
 classpath/java/lang/Override.java \
-java/lang/Package.java \
+classpath/java/lang/Package.java \
 java/lang/PosixProcess.java \
 classpath/java/lang/Process.java \
 java/lang/ProcessBuilder.java \
@@ -5020,7 +5020,7 @@
 classpath/java/security/SecureClassLoader.java \
 classpath/java/security/SecureRandom.java \
 classpath/java/security/SecureRandomSpi.java \
-java/security/Security.java \
+classpath/java/security/Security.java \
 classpath/java/security/SecurityPermission.java \
 classpath/java/security/Signature.java \
 classpath/java/security/SignatureException.java \
@@ -5309,7 +5309,7 @@
 classpath/external/jsr166/java/util/Queue.java \
 classpath/java/util/Random.java \
 classpath/java/util/RandomAccess.java \
-java/util/ResourceBundle.java \
+classpath/java/util/ResourceBundle.java \
 classpath/java/util/Set.java \
 classpath/java/util/SimpleTimeZone.java \
 classpath/java/util/SortedMap.java \
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 119303)
+++ Makefile.in	(working copy)
@@ -318,8 +318,7 @@
 	java/nio/natDirectByteBufferImpl.cc \
 	java/security/natVMAccessController.cc \
 	java/security/natVMAccessControlState.cc \
-	java/text/natCollator.cc java/util/natResourceBundle.cc \
-	java/util/natVMTimeZone.cc \
+	java/text/natCollator.cc java/util/natVMTimeZone.cc \
 	java/util/concurrent/atomic/natAtomicLong.cc \
 	java/util/logging/natLogger.cc java/util/zip/natDeflater.cc \
 	java/util/zip/natInflater.cc sun/misc/natUnsafe.cc \
@@ -383,8 +382,7 @@
 	java/nio/natDirectByteBufferImpl.lo \
 	java/security/natVMAccessController.lo \
 	java/security/natVMAccessControlState.lo \
-	java/text/natCollator.lo java/util/natResourceBundle.lo \
-	java/util/natVMTimeZone.lo \
+	java/text/natCollator.lo java/util/natVMTimeZone.lo \
 	java/util/concurrent/atomic/natAtomicLong.lo \
 	java/util/logging/natLogger.lo java/util/zip/natDeflater.lo \
 	java/util/zip/natInflater.lo sun/misc/natUnsafe.lo \
@@ -4076,7 +4074,7 @@
 java/lang/Object.java \
 classpath/java/lang/OutOfMemoryError.java \
 classpath/java/lang/Override.java \
-java/lang/Package.java \
+classpath/java/lang/Package.java \
 java/lang/PosixProcess.java \
 classpath/java/lang/Process.java \
 java/lang/ProcessBuilder.java \
@@ -4494,7 +4492,7 @@
 classpath/java/security/SecureClassLoader.java \
 classpath/java/security/SecureRandom.java \
 classpath/java/security/SecureRandomSpi.java \
-java/security/Security.java \
+classpath/java/security/Security.java \
 classpath/java/security/SecurityPermission.java \
 classpath/java/security/Signature.java \
 classpath/java/security/SignatureException.java \
@@ -4727,7 +4725,7 @@
 classpath/external/jsr166/java/util/Queue.java \
 classpath/java/util/Random.java \
 classpath/java/util/RandomAccess.java \
-java/util/ResourceBundle.java \
+classpath/java/util/ResourceBundle.java \
 classpath/java/util/Set.java \
 classpath/java/util/SimpleTimeZone.java \
 classpath/java/util/SortedMap.java \
@@ -7655,7 +7653,6 @@
 java/security/natVMAccessController.cc \
 java/security/natVMAccessControlState.cc \
 java/text/natCollator.cc \
-java/util/natResourceBundle.cc \
 java/util/natVMTimeZone.cc \
 java/util/concurrent/atomic/natAtomicLong.cc \
 java/util/logging/natLogger.cc \
@@ -8228,8 +8225,6 @@
 java/util/$(DEPDIR)/$(am__dirstamp):
 	@$(mkdir_p) java/util/$(DEPDIR)
 	@: > java/util/$(DEPDIR)/$(am__dirstamp)
-java/util/natResourceBundle.lo: java/util/$(am__dirstamp) \
-	java/util/$(DEPDIR)/$(am__dirstamp)
 java/util/natVMTimeZone.lo: java/util/$(am__dirstamp) \
 	java/util/$(DEPDIR)/$(am__dirstamp)
 java/util/concurrent/atomic/$(am__dirstamp):
@@ -8604,8 +8599,6 @@
 	-rm -f java/util/concurrent/atomic/natAtomicLong.lo
 	-rm -f java/util/logging/natLogger.$(OBJEXT)
 	-rm -f java/util/logging/natLogger.lo
-	-rm -f java/util/natResourceBundle.$(OBJEXT)
-	-rm -f java/util/natResourceBundle.lo
 	-rm -f java/util/natVMTimeZone.$(OBJEXT)
 	-rm -f java/util/natVMTimeZone.lo
 	-rm -f java/util/zip/natDeflater.$(OBJEXT)
@@ -8740,7 +8733,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@java/security/$(DEPDIR)/natVMAccessControlState.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@java/security/$(DEPDIR)/natVMAccessController.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@java/text/$(DEPDIR)/natCollator.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@java/util/$(DEPDIR)/natResourceBundle.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@java/util/$(DEPDIR)/natVMTimeZone.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@java/util/concurrent/atomic/$(DEPDIR)/natAtomicLong.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@java/util/logging/$(DEPDIR)/natLogger.Plo@am__quote@


More information about the Java-patches mailing list