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:
@@ -1,5 +1,5 @@
|
||||
/* FileChannelImpl.java --
|
||||
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -301,8 +301,10 @@ public final class FileChannelImpl extends FileChannel
|
||||
else if (mode == MapMode.READ_WRITE || mode == MapMode.PRIVATE)
|
||||
{
|
||||
nmode = mode == MapMode.READ_WRITE ? '+' : 'c';
|
||||
if ((this.mode & (READ|WRITE)) != (READ|WRITE))
|
||||
if ((this.mode & WRITE) != WRITE)
|
||||
throw new NonWritableChannelException();
|
||||
if ((this.mode & READ) != READ)
|
||||
throw new NonReadableChannelException();
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException ("mode: " + mode);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* IconvProvider.java --
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
@@ -48,20 +48,17 @@ import java.util.Vector;
|
||||
/**
|
||||
* Charset provider wrapping iconv.
|
||||
*
|
||||
* 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 Sven de Marothy
|
||||
*/
|
||||
public final class IconvProvider extends CharsetProvider
|
||||
{
|
||||
private static IconvProvider singleton;
|
||||
|
||||
static
|
||||
{
|
||||
synchronized (IconvProvider.class)
|
||||
{
|
||||
singleton = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Declaring the construtor public may violate the use of singleton.
|
||||
// But it must be public so that an instance of this class can be
|
||||
// created by Class.newInstance(), which is the case when this provider is
|
||||
|
||||
Reference in New Issue
Block a user