Imported GNU Classpath 0.20

Imported GNU Classpath 0.20
       * Makefile.am (AM_CPPFLAGS): Add classpath/include.
       * java/nio/charset/spi/CharsetProvider.java: New override file.
       * java/security/Security.java: Likewise.
       * sources.am: Regenerated.
       * Makefile.in: Likewise.

From-SVN: r109831
This commit is contained in:
Mark Wielaard
2006-01-17 18:09:40 +00:00
parent bcb36c3e02
commit 2127637945
444 changed files with 75778 additions and 30731 deletions
@@ -1,5 +1,5 @@
/* Provider.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,8 @@ package gnu.java.nio.charset;
import java.nio.charset.Charset;
import java.nio.charset.spi.CharsetProvider;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -47,6 +49,11 @@ import java.util.Iterator;
* Charset provider for the required charsets. Used by
* {@link Charset#charsetForName} and * {@link Charset#availableCharsets}.
*
* Note: This class is a privileged class, because it can be instantiated without
* requiring the RuntimePermission("charsetProvider"). There is a check in
* java.nio.charset.spi.CharsetProvider to skip the security check if the provider
* is an instance of this class.
*
* @author Jesse Rosenstock
* @author Robert Schuster (thebohemian@gmx.net)
* @see Charset
@@ -55,14 +62,6 @@ public final class Provider extends CharsetProvider
{
private static Provider singleton;
static
{
synchronized (Provider.class)
{
singleton = null;
}
}
/**
* Map from charset name to charset canonical name. The strings
* are all lower-case to allow case-insensitive retrieval of
@@ -232,8 +231,16 @@ public final class Provider extends CharsetProvider
public static synchronized Provider provider ()
{
// The default provider is safe to instantiate.
if (singleton == null)
singleton = new Provider ();
singleton = (Provider) AccessController.doPrivileged
(new PrivilegedAction()
{
public Object run()
{
return new Provider();
}
});
return singleton;
}
}