OSDN Git Service

* sources.am, Makefile.in: Rebuilt.
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 May 2006 02:16:22 +0000 (02:16 +0000)
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 May 2006 02:16:22 +0000 (02:16 +0000)
* java/util/logging/LogManager.java: Removed.
* java/util/logging/Logger.java (resetLogger): New method, from
Classpath.
* java/io/RandomAccessFile.java: Removed.
* gnu/java/nio/channels/FileChannelImpl.java (create): New
method.
(FileChannelImpl): Now private.
* java/io/FileInputStream.java: Removed.
* java/io/FileOutputStream.java: Removed.
* java/security/AccessControlContext.java: Removed.
* java/lang/ThreadLocal.java: Removed.
* java/lang/InheritableThreadLocal.java: Removed.
* java/lang/Thread.java (locals): New field.
(getThreadLocals): New method.
* java/lang/natThread.cc (finish_): Clear 'locals'.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113735 138bc75d-0d04-0410-961f-82ee72b054a4

14 files changed:
libjava/ChangeLog
libjava/Makefile.in
libjava/gnu/java/nio/channels/FileChannelImpl.java
libjava/java/io/FileInputStream.java [deleted file]
libjava/java/io/FileOutputStream.java [deleted file]
libjava/java/io/RandomAccessFile.java [deleted file]
libjava/java/lang/InheritableThreadLocal.java [deleted file]
libjava/java/lang/Thread.java
libjava/java/lang/ThreadLocal.java [deleted file]
libjava/java/lang/natThread.cc
libjava/java/security/AccessControlContext.java [deleted file]
libjava/java/util/logging/LogManager.java [deleted file]
libjava/java/util/logging/Logger.java
libjava/sources.am

index aea1ae6..d8fb754 100644 (file)
@@ -1,3 +1,22 @@
+2006-05-12  Tom Tromey  <tromey@redhat.com>
+
+       * sources.am, Makefile.in: Rebuilt.
+       * java/util/logging/LogManager.java: Removed.
+       * java/util/logging/Logger.java (resetLogger): New method, from
+       Classpath.
+       * java/io/RandomAccessFile.java: Removed.
+       * gnu/java/nio/channels/FileChannelImpl.java (create): New
+       method.
+       (FileChannelImpl): Now private.
+       * java/io/FileInputStream.java: Removed.
+       * java/io/FileOutputStream.java: Removed.
+       * java/security/AccessControlContext.java: Removed.
+       * java/lang/ThreadLocal.java: Removed.
+       * java/lang/InheritableThreadLocal.java: Removed.
+       * java/lang/Thread.java (locals): New field.
+       (getThreadLocals): New method.
+       * java/lang/natThread.cc (finish_): Clear 'locals'.
+
 2006-05-11  Bryce McKinlay  <mckinlay@redhat.com>
 
        * gnu/gcj/runtime/NameFinder.java (lookup): If exec'ing addr2line
index eb4af80..fcbe2cf 100644 (file)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.9.3 from Makefile.am.
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004  Free Software Foundation, Inc.
+# 2003, 2004, 2005  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -17,8 +17,6 @@
 
 
 
-SOURCES = $(lib_gnu_awt_xlib_la_SOURCES) $(lib_gnu_java_awt_peer_gtk_la_SOURCES) $(lib_gnu_java_awt_peer_qt_la_SOURCES) $(libgcj_la_SOURCES) $(libgcjawt_la_SOURCES) $(libgij_la_SOURCES) $(gcj_dbtool_SOURCES) $(gen_from_JIS_SOURCES) $(gij_SOURCES) $(grmic_SOURCES) $(grmiregistry_SOURCES) $(jv_convert_SOURCES)
-
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@
@@ -3512,9 +3510,9 @@ classpath/java/io/Externalizable.java \
 java/io/File.java \
 classpath/java/io/FileDescriptor.java \
 classpath/java/io/FileFilter.java \
-java/io/FileInputStream.java \
+classpath/java/io/FileInputStream.java \
 classpath/java/io/FileNotFoundException.java \
-java/io/FileOutputStream.java \
+classpath/java/io/FileOutputStream.java \
 classpath/java/io/FilePermission.java \
 classpath/java/io/FileReader.java \
 classpath/java/io/FileWriter.java \
@@ -3554,7 +3552,7 @@ java/io/PrintStream.java \
 classpath/java/io/PrintWriter.java \
 classpath/java/io/PushbackInputStream.java \
 classpath/java/io/PushbackReader.java \
-java/io/RandomAccessFile.java \
+classpath/java/io/RandomAccessFile.java \
 classpath/java/io/Reader.java \
 classpath/java/io/SequenceInputStream.java \
 classpath/java/io/Serializable.java \
@@ -3607,7 +3605,7 @@ classpath/java/lang/IllegalStateException.java \
 classpath/java/lang/IllegalThreadStateException.java \
 classpath/java/lang/IncompatibleClassChangeError.java \
 classpath/java/lang/IndexOutOfBoundsException.java \
-java/lang/InheritableThreadLocal.java \
+classpath/java/lang/InheritableThreadLocal.java \
 classpath/java/lang/InstantiationError.java \
 classpath/java/lang/InstantiationException.java \
 classpath/java/lang/Integer.java \
@@ -3647,7 +3645,7 @@ java/lang/System.java \
 java/lang/Thread.java \
 classpath/java/lang/ThreadDeath.java \
 classpath/java/lang/ThreadGroup.java \
-java/lang/ThreadLocal.java \
+classpath/java/lang/ThreadLocal.java \
 classpath/java/lang/Throwable.java \
 classpath/java/lang/TypeNotPresentException.java \
 classpath/java/lang/UnknownError.java \
@@ -3935,7 +3933,7 @@ classpath/java/rmi/server/Unreferenced.java
 
 java_rmi_server_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_rmi_server_source_files)))
 java_security_source_files = \
-java/security/AccessControlContext.java \
+classpath/java/security/AccessControlContext.java \
 classpath/java/security/AccessControlException.java \
 java/security/AccessController.java \
 classpath/java/security/AlgorithmParameterGenerator.java \
@@ -4236,7 +4234,7 @@ classpath/java/util/logging/Filter.java \
 classpath/java/util/logging/Formatter.java \
 classpath/java/util/logging/Handler.java \
 classpath/java/util/logging/Level.java \
-java/util/logging/LogManager.java \
+classpath/java/util/logging/LogManager.java \
 classpath/java/util/logging/LogRecord.java \
 java/util/logging/Logger.java \
 classpath/java/util/logging/LoggingPermission.java \
@@ -7994,7 +7992,13 @@ uninstall-toolexecmainlibDATA:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-       @set fnord $$MAKEFLAGS; amf=$$2; \
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
        dot_seen=no; \
        target=`echo $@ | sed s/-recursive//`; \
        list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -8006,7 +8010,7 @@ $(RECURSIVE_TARGETS):
            local_target="$$target"; \
          fi; \
          (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+         || eval $$failcom; \
        done; \
        if test "$$dot_seen" = "no"; then \
          $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
@@ -8014,7 +8018,13 @@ $(RECURSIVE_TARGETS):
 
 mostlyclean-recursive clean-recursive distclean-recursive \
 maintainer-clean-recursive:
-       @set fnord $$MAKEFLAGS; amf=$$2; \
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
        dot_seen=no; \
        case "$@" in \
          distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -8035,7 +8045,7 @@ maintainer-clean-recursive:
            local_target="$$target"; \
          fi; \
          (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-          || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+         || eval $$failcom; \
        done && test -z "$$fail"
 tags-recursive:
        list='$(SUBDIRS)'; for subdir in $$list; do \
index 6059b56..db68b59 100644 (file)
@@ -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.
 
@@ -103,7 +103,16 @@ public final class FileChannelImpl extends FileChannel
   }
 
   /* Open a file.  MODE is a combination of the above mode flags. */
-  public FileChannelImpl (File file, int mode) throws FileNotFoundException
+  /* This is a static factory method, so that VM implementors can decide
+   * substitute subclasses of FileChannelImpl. */
+  public static FileChannelImpl create(File file, int mode)
+    throws FileNotFoundException
+  {
+    return new FileChannelImpl(file, mode);
+  }
+
+  /* Open a file.  MODE is a combination of the above mode flags. */
+  private FileChannelImpl (File file, int mode) throws FileNotFoundException
   {
     final String path = file.getPath();
     fd = open (path, mode);
diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java
deleted file mode 100644 (file)
index f6a8faa..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/* FileInputStream.java -- An input stream that reads from disk files.
-   Copyright (C) 1998, 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.io;
-
-import gnu.java.nio.channels.FileChannelImpl;
-
-import java.nio.channels.FileChannel;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status:  Believed complete and correct.
- */
-/**
- * This class is a stream that reads its bytes from a file. 
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy (warrenl@cygnus.com)
- */
-public class FileInputStream extends InputStream
-{
-  /**
-   * This is the native file handle for the file this stream is reading from
-   */
-  private FileDescriptor fd;
-
-  private FileChannelImpl ch;
-
-  /**
-   * This method initializes a <code>FileInputStream</code> to read from the
-   * specified named file.  A security check is first made to determine
-   * whether or not access to this file is allowed.  This is done by
-   * calling the <code>checkRead()</code> method of the 
-   * <code>SecurityManager</code>
-   * (if one exists) with the name of this file.  An exception is thrown
-   * if reading is not allowed.  If the file does not exist, an exception
-   * is also thrown.
-   *
-   * @param name The name of the file this stream should read from
-   *
-   * @exception SecurityException If read access to the file is not allowed
-   * @exception FileNotFoundException If the file does not exist 
-   * or if it is a directory
-   */
-  public FileInputStream(String name) throws FileNotFoundException
-  {
-    this(new File(name));
-  }
-
-  /**
-   * This method initializes a <code>FileInputStream</code> to read from the
-   * specified <code>File</code> object.  A security check is first
-   * made to determine
-   * whether or not access to this file is allowed.  This is done by
-   * calling the <code>checkRead()</code> method of the
-   * <code>SecurityManager</code>
-   * (if one exists) with the name of this file.  An exception is thrown
-   * if reading is not allowed.  If the file does not exist, an exception
-   * is also thrown.
-   *
-   * @param file The <code>File</code> object this stream should read from
-   *
-   * @exception SecurityException If read access to the file is not allowed
-   * @exception FileNotFoundException If the file does not exist
-   * or if it is a directory.
-   */
-  public FileInputStream(File file) throws FileNotFoundException
-  {
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
-      s.checkRead(file.getPath());
-
-    ch = new FileChannelImpl (file, FileChannelImpl.READ);
-  }
-
-  /**
-   * This method initializes a <code>FileInputStream</code> to read from the
-   * specified <code>FileDescriptor</code> object.  A security
-   * check is first made to
-   * determine whether or not access to this file is allowed.  This is done by
-   * calling the <code>checkRead()</code> method of the 
-   * <code>SecurityManager</code>
-   * (if one exists) with the specified <code>FileDescriptor</code>  
-   * An exception is 
-   * thrown if reading is not allowed.
-   *
-   * @param fdObj The <code>FileDescriptor</code> object this stream 
-   * should read from
-   *
-   * @exception SecurityException If read access to the file is not allowed
-   */
-  public FileInputStream(FileDescriptor fdObj)
-  {
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
-      s.checkRead(fdObj);
-
-    fd = fdObj;
-    ch = (FileChannelImpl) fdObj.channel;
-  }
-
-  FileInputStream(FileChannelImpl ch)
-  {
-    this.ch = ch;
-  }
-
-  /**
-   * This method returns the number of bytes that can be read from this
-   * stream before a read can block.  A return of 0 indicates that blocking
-   * might (or might not) occur on the very next read attempt.
-   * <p>
-   * This method returns the number of unread bytes remaining in the file if
-   * the descriptor being read from is an actual file.  If this method is
-   * reading from a ''special'' file such a the standard input, this method
-   * will return the appropriate value for the stream being read.
-   * <p>
-   * Be aware that reads on plain files that do not reside locally might
-   * possibly block even if this method says they should not.  For example,
-   * a remote server might crash, preventing an NFS mounted file from being
-   * read.
-   *
-   * @return The number of bytes that can be read before blocking could occur
-   *
-   * @exception IOException If an error occurs
-   */
-  public int available() throws IOException
-  {
-    return ch.available();
-  }
-
-  /**
-   * This method closes the stream.  Any futher attempts to read from the
-   * stream will likely generate an IOException since the underlying file
-   * will be closed.
-   *
-   * @exception IOException If an error occurs.
-   */
-  public void close() throws IOException
-  {
-    ch.close();
-  }
-
-  protected void finalize() throws IOException
-  {
-    // We don't actually need this, but we include it because it is
-    // mentioned in the JCL.
-  }
-
-  /**
-   * This method returns a <code>FileDescriptor</code> object representing the
-   * underlying native file handle of the file this stream is reading
-   * from
-   *
-   * @return A <code>FileDescriptor</code> for this stream
-   *
-   * @exception IOException If an error occurs
-   */
-  public final FileDescriptor getFD() throws IOException
-  {
-    synchronized (this)
-      {
-       if (fd == null)
-         fd = new FileDescriptor (ch);
-       return fd;
-      }
-  }
-
-  /**
-   * This method reads an unsigned byte from the input stream and returns it
-   * as an int in the range of 0-255.  This method also will return -1 if
-   * the end of the stream has been reached.
-   * <p>
-   * This method will block until the byte can be read.
-   *
-   * @return The byte read or -1 if end of stream
-   *
-   * @exception IOException If an error occurs
-   */
-  public int read() throws IOException
-  {
-    return ch.read();
-  }
-
-  /**
-   * This method reads bytes from a stream and stores them into a caller
-   * supplied buffer.  This method attempts to completely fill the buffer,
-   * but can return before doing so.  The actual number of bytes read is
-   * returned as an int.  A -1 is returned to indicate the end of the stream.
-   * <p>
-   * This method will block until some data can be read.
-   * <p>
-   * This method operates by calling an overloaded read method like so:
-   * <code>read(buf, 0, buf.length)</code>
-   *
-   * @param buf The buffer into which the bytes read will be stored.
-   *
-   * @return The number of bytes read or -1 if end of stream.
-   *
-   * @exception IOException If an error occurs.
-   */
-  public int read(byte[] buf) throws IOException
-  {
-    return read(buf, 0, buf.length);
-  }
-
-  /**
-   * This method read bytes from a stream and stores them into a caller
-   * supplied buffer.  It starts storing the data at index 
-   * <code>offset</code> into
-   * the buffer and attempts to read <code>len</code> bytes.  This method can
-   * return before reading the number of bytes requested.  The actual number
-   * of bytes read is returned as an int.  A -1 is returned to indicate the
-   * end of the stream.
-   * <p>
-   * This method will block until some data can be read.
-   *
-   * @param buf The array into which the bytes read should be stored
-   * @param offset The offset into the array to start storing bytes
-   * @param len The requested number of bytes to read
-   *
-   * @return The actual number of bytes read, or -1 if end of stream.
-   *
-   * @exception IOException If an error occurs.
-   */
-  public int read(byte[] buf, int offset, int len) throws IOException
-  {
-    if (offset < 0
-        || len < 0
-        || offset + len > buf.length)
-      throw new ArrayIndexOutOfBoundsException();
-
-    return ch.read(buf, offset, len);
-  }
-
-  /**
-   * This method skips the specified number of bytes in the stream.  It
-   * returns the actual number of bytes skipped, which may be less than the
-   * requested amount.
-   * <p>
-   * @param numBytes The requested number of bytes to skip
-   *
-   * @return The actual number of bytes skipped.
-   *
-   * @exception IOException If an error occurs
-   */
-  public synchronized long skip (long numBytes) throws IOException
-  {
-    if (numBytes < 0)
-      throw new IllegalArgumentException ("Can't skip negative bytes: " + 
-                                          numBytes);
-
-    if (numBytes == 0)
-      return 0;
-
-    long oldPos = ch.position ();
-    ch.position(oldPos + numBytes);
-    return ch.position() - oldPos;
-  }
-
-  /**
-   * This method creates a java.nio.channels.FileChannel.
-   * Nio does not allow one to create a file channel directly.
-   * A file channel must be created by first creating an instance of
-   * Input/Output/RandomAccessFile and invoking the getChannel() method on it.
-   */
-  public synchronized FileChannel getChannel () 
-  {
-    return ch;
-  }
-
-} // class FileInputStream
-
diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java
deleted file mode 100644 (file)
index 40e72af..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-/* FileOutputStream.java -- Writes to a file on disk.
-   Copyright (C) 1998, 2001, 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.io;
-
-import gnu.java.nio.channels.FileChannelImpl;
-
-import java.nio.channels.FileChannel;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status:  Complete to version 1.1.
- */
-
-/**
- * This classes allows a stream of data to be written to a disk file or
- * any open <code>FileDescriptor</code>.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class FileOutputStream extends OutputStream
-{
-  private FileDescriptor fd;
-
-  private FileChannelImpl ch;
-
-  /**
-   * This method initializes a <code>FileOutputStream</code> object to write
-   * to the named file.  The file is created if it does not exist, and
-   * the bytes written are written starting at the beginning of the file if
-   * the <code>append</code> argument is <code>false</code> or at the end
-   * of the file if the <code>append</code> argument is true.
-   * <p>
-   * Before opening a file, a security check is performed by calling the
-   * <code>checkWrite</code> method of the <code>SecurityManager</code> (if
-   * one exists) with the name of the file to be opened.  An exception is
-   * thrown if writing is not allowed. 
-   *
-   * @param path The name of the file this stream should write to
-   * @param append <code>true</code> to append bytes to the end of the file,
-   * or <code>false</code> to write bytes to the beginning
-   *
-   * @exception SecurityException If write access to the file is not allowed
-   * @exception FileNotFoundException If a non-security error occurs
-   */
-  public FileOutputStream (String path, boolean append)
-    throws SecurityException, FileNotFoundException
-  {
-    this (new File(path), append);
-  }
-
-  /**
-   * This method initializes a <code>FileOutputStream</code> object to write
-   * to the named file.  The file is created if it does not exist, and
-   * the bytes written are written starting at the beginning of the file.
-   * <p>
-   * Before opening a file, a security check is performed by calling the
-   * <code>checkWrite</code> method of the <code>SecurityManager</code> (if
-   * one exists) with the name of the file to be opened.  An exception is
-   * thrown if writing is not allowed. 
-   *
-   * @param path The name of the file this stream should write to
-   *
-   * @exception SecurityException If write access to the file is not allowed
-   * @exception FileNotFoundException If a non-security error occurs
-   */
-  public FileOutputStream (String path)
-    throws SecurityException, FileNotFoundException
-  {
-    this (path, false);
-  }
-
-  /**
-   * This method initializes a <code>FileOutputStream</code> object to write
-   * to the specified <code>File</code> object.  The file is created if it 
-   * does not exist, and the bytes written are written starting at the 
-   * beginning of the file.
-   * <p>
-   * Before opening a file, a security check is performed by calling the
-   * <code>checkWrite</code> method of the <code>SecurityManager</code> (if
-   * one exists) with the name of the file to be opened.  An exception is
-   * thrown if writing is not allowed. 
-   *
-   * @param file The <code>File</code> object this stream should write to
-   *
-   * @exception SecurityException If write access to the file is not allowed
-   * @exception FileNotFoundException If a non-security error occurs
-   */
-  public FileOutputStream (File file)
-    throws SecurityException, FileNotFoundException
-  {
-    this (file, false);
-  }
-
-  /**
-   * This method initializes a <code>FileOutputStream</code> object to write
-   * to the specified <code>File</code> object.  The file is created if it 
-   * does not exist, and the bytes written are written starting at the 
-   * beginning of the file if the <code>append</code> parameter is 
-   * <code>false</code>.  Otherwise bytes are written at the end of the
-   * file.
-   * <p>
-   * Before opening a file, a security check is performed by calling the
-   * <code>checkWrite</code> method of the <code>SecurityManager</code> (if
-   * one exists) with the name of the file to be opened.  An exception is
-   * thrown if writing is not allowed. 
-   *
-   * @param file The <code>File</code> object this stream should write to
-   * @param append <code>true</code> to append bytes to the end of the file,
-   * or <code>false</code> to write bytes to the beginning
-   *
-   * @exception SecurityException If write access to the file is not allowed
-   * @exception FileNotFoundException If a non-security error occurs
-   */
-  public FileOutputStream (File file, boolean append)
-    throws FileNotFoundException
-  {
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
-      s.checkWrite(file.getPath());
-
-   ch = new FileChannelImpl (file, (append
-                                   ? FileChannelImpl.WRITE
-                                   | FileChannelImpl.APPEND
-                                   : FileChannelImpl.WRITE));
-  }
-
-  /**
-   * This method initializes a <code>FileOutputStream</code> object to write
-   * to the file represented by the specified <code>FileDescriptor</code>
-   * object.  This method does not create any underlying disk file or
-   * reposition the file pointer of the given descriptor.  It assumes that
-   * this descriptor is ready for writing as is.
-   * <p>
-   * Before opening a file, a security check is performed by calling the
-   * <code>checkWrite</code> method of the <code>SecurityManager</code> (if
-   * one exists) with the specified <code>FileDescriptor</code> as an argument.
-   * An exception is thrown if writing is not allowed. 
-   *
-   * @param fdObj The <code>FileDescriptor</code> this stream should write to
-   *
-   * @exception SecurityException If write access to the file is not allowed
-   */
-  public FileOutputStream (FileDescriptor fdObj)
-    throws SecurityException
-  {
-    // Hmm, no other exception but this one to throw, but if the descriptor
-    // isn't valid, we surely don't have "permission" to write to it.
-    if (!fdObj.valid())
-      throw new SecurityException("Invalid FileDescriptor");
-
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
-      s.checkWrite(fdObj);
-
-    fd = fdObj;
-    ch = (FileChannelImpl) fdObj.channel;
-  }
-
-  FileOutputStream(FileChannelImpl ch)
-  {
-    this.ch = ch;
-  }
-
-  protected void finalize () throws IOException
-  {
-    // We don't actually need this, but we include it because it is
-    // mentioned in the JCL.
-  }
-
-  /**
-   * This method returns a <code>FileDescriptor</code> object representing
-   * the file that is currently being written to
-   *
-   * @return A <code>FileDescriptor</code> object for this stream
-   *
-   * @exception IOException If an error occurs
-   */
-  public final FileDescriptor getFD () throws IOException
-  {
-    synchronized (this)
-      {
-       if (fd == null)
-         fd = new FileDescriptor (ch);
-       return fd;
-      }
-  }
-
-  /**
-   * This method writes a single byte of data to the file.  
-   *
-   * @param b The byte of data to write, passed as an <code>int</code>
-   *
-   * @exception IOException If an error occurs
-   */
-  public void write (int b) throws IOException
-  {
-    ch.write (b);
-  }
-
-  /**
-   * This method writes all the bytes in the specified array to the
-   * file.
-   *
-   * @param buf The array of bytes to write to the file
-   *
-   * @exception IOException If an error occurs
-   */
-  public void write (byte[] buf)
-    throws IOException
-  {
-    write (buf, 0, buf.length);
-  }
-
-  /**
-   * This method writes <code>len</code> bytes from the byte array 
-   * <code>buf</code> to the file starting at index <code>offset</code>.
-   *
-   * @param buf The array of bytes to write to the file
-   * @param offset The offset into the array to start writing bytes from
-   * @param len The number of bytes to write to the file
-   *
-   * @exception IOException If an error occurs
-   */
-  public void write (byte[] buf, int offset, int len)
-    throws IOException
-  {
-    if (offset < 0
-        || len < 0
-        || offset + len > buf.length)
-      throw new ArrayIndexOutOfBoundsException ();
-    
-    ch.write (buf, offset, len);
-  }
-
-  /**
-   * This method closes the underlying file.  Any further attempts to
-   * write to this stream will likely generate an exception since the
-   * file is closed.
-   *
-   * @exception IOException If an error occurs
-   */
-  public void close () throws IOException
-  {
-    ch.close();
-  }
-
-  /**
-   * This method creates a java.nio.channels.FileChannel.
-   * Nio does not allow one to create a file channel directly.
-   * A file channel must be created by first creating an instance of
-   * Input/Output/RandomAccessFile and invoking the getChannel() method on it.
-   */
-  public synchronized FileChannel getChannel() 
-  {
-    return ch;
-  }
-
-} // class FileOutputStream
-
diff --git a/libjava/java/io/RandomAccessFile.java b/libjava/java/io/RandomAccessFile.java
deleted file mode 100644 (file)
index 129d6b6..0000000
+++ /dev/null
@@ -1,991 +0,0 @@
-/* RandomAccessFile.java -- Class supporting random file I/O
-   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.io;
-
-import gnu.java.nio.channels.FileChannelImpl;
-
-import java.nio.channels.FileChannel;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * Status: Believe complete and correct to 1.1.
- */
-
-/**
- * This class allows reading and writing of files at random locations.
- * Most Java I/O classes are either pure sequential input or output.  This
- * class fulfills the need to be able to read the bytes of a file in an
- * arbitrary order.  In addition, this class implements the
- * <code>DataInput</code> and <code>DataOutput</code> interfaces to allow
- * the reading and writing of Java primitives.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
- */
-public class RandomAccessFile implements DataOutput, DataInput
-{
-
-  // The underlying file.
-  private FileChannelImpl ch;
-  private FileDescriptor fd;
-  // The corresponding input and output streams.
-  private DataOutputStream out;
-  private DataInputStream in;
-  
-  
-  /**
-   * This method initializes a new instance of <code>RandomAccessFile</code>
-   * to read from the specified <code>File</code> object with the specified 
-   * access mode.   The access mode is either "r" for read only access or "rw" 
-   * for read-write access.
-   * <p>
-   * Note that a <code>SecurityManager</code> check is made prior to
-   * opening the file to determine whether or not this file is allowed to
-   * be read or written.
-   *
-   * @param file The <code>File</code> object to read and/or write.
-   * @param mode "r" for read only or "rw" for read-write access to the file
-   *
-   * @exception IllegalArgumentException If <code>mode</code> has an 
-   * illegal value
-   * @exception SecurityException If the requested access to the file 
-   * is not allowed
-   * @exception FileNotFoundException If the file is a directory, or 
-   * any other error occurs
-   */
-  public RandomAccessFile (File file, String mode)
-    throws FileNotFoundException
-  {
-    int fdmode;
-    if (mode.equals("r"))
-      fdmode = FileChannelImpl.READ;
-    else if (mode.equals("rw"))
-      fdmode = FileChannelImpl.READ | FileChannelImpl.WRITE;
-    else if (mode.equals("rws"))
-      {
-       fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE
-                 | FileChannelImpl.SYNC);
-      }
-    else if (mode.equals("rwd"))
-      {
-       fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE
-                 | FileChannelImpl.DSYNC);
-      }
-    else
-      throw new IllegalArgumentException ("invalid mode: " + mode);
-
-    final String fileName = file.getPath();
-
-    // The obligatory SecurityManager stuff
-    SecurityManager s = System.getSecurityManager();
-    if (s != null)
-      {
-        s.checkRead(fileName);
-
-        if ((fdmode & FileChannelImpl.WRITE) != 0)
-          s.checkWrite(fileName);
-      }
-
-    ch = new FileChannelImpl (file, fdmode);
-    fd = new FileDescriptor(ch);
-    out = new DataOutputStream (new FileOutputStream (fd));
-    in = new DataInputStream (new FileInputStream (fd));
-  }
-
-  /**
-   * This method initializes a new instance of <code>RandomAccessFile</code>
-   * to read from the specified file name with the specified access mode.
-   * The access mode is either "r" for read only access, "rw" for read
-   * write access, "rws" for synchronized read/write access of both
-   * content and metadata, or "rwd" for read/write access
-   * where only content is required to be synchronous.
-   * <p>
-   * Note that a <code>SecurityManager</code> check is made prior to
-   * opening the file to determine whether or not this file is allowed to
-   * be read or written.
-   *
-   * @param fileName The name of the file to read and/or write
-   * @param mode "r", "rw", "rws", or "rwd"
-   *
-   * @exception IllegalArgumentException If <code>mode</code> has an 
-   * illegal value
-   * @exception SecurityException If the requested access to the file 
-   * is not allowed
-   * @exception FileNotFoundException If the file is a directory or 
-   * any other error occurs
-   */
-  public RandomAccessFile (String fileName, String mode)
-    throws FileNotFoundException
-  {
-    this (new File(fileName), mode);
-  }
-
-  /**
-   * This method closes the file and frees up all file related system
-   * resources.  Since most operating systems put a limit on how many files
-   * may be opened at any given time, it is a good idea to close all files
-   * when no longer needed to avoid hitting this limit
-   */
-  public void close () throws IOException
-  {
-    ch.close();
-  }
-
-  /**
-   * This method returns a <code>FileDescriptor</code> object that 
-   * represents the native file handle for this file.
-   *
-   * @return The <code>FileDescriptor</code> object for this file
-   *
-   * @exception IOException If an error occurs
-   */
-  public final FileDescriptor getFD () throws IOException
-  {
-    synchronized (this)
-      {
-       if (fd == null)
-         fd = new FileDescriptor (ch);
-       return fd;
-      }
-  }
-
-  /**
-   * This method returns the current offset in the file at which the next
-   * read or write will occur
-   *
-   * @return The current file position
-   *
-   * @exception IOException If an error occurs
-   */
-  public long getFilePointer () throws IOException
-  {
-    return ch.position();
-  }
-
-  /**
-   * This method sets the length of the file to the specified length.
-   * If the currently length of the file is longer than the specified
-   * length, then the file is truncated to the specified length (the
-   * file position is set to the end of file in this case).  If the
-   * current length of the file is shorter than the specified length,
-   * the file is extended with bytes of an undefined value (the file
-   * position is unchanged in this case).
-   * <p>
-   * The file must be open for write access for this operation to succeed.
-   *
-   * @param newLen The new length of the file
-   *
-   * @exception IOException If an error occurs
-   */
-  public void setLength (long newLen) throws IOException
-  {
-    // FIXME: Extending a file should probably be done by one method call.
-
-    // FileChannel.truncate() can only shrink a file.
-    // To expand it we need to seek forward and write at least one byte.
-    if (newLen < length())
-      ch.truncate (newLen);
-    else if (newLen > length())
-      {
-       long pos = getFilePointer();
-       seek(newLen - 1);
-       write(0);
-       seek(pos);
-      }
-  }
-
-  /**
-   * This method returns the length of the file in bytes
-   *
-   * @return The length of the file
-   *
-   * @exception IOException If an error occurs
-   */
-  public long length () throws IOException
-  {
-    return ch.size();
-  }
-
-  /**
-   * This method reads a single byte of data from the file and returns it
-   * as an integer.
-   *
-   * @return The byte read as an int, or -1 if the end of the file was reached.
-   *
-   * @exception IOException If an error occurs
-   */
-  public int read () throws IOException
-  {
-    return in.read();
-  }
-
-  /**
-   * This method reads bytes from the file into the specified array.  The
-   * bytes are stored starting at the beginning of the array and up to 
-   * <code>buf.length</code> bytes can be read.
-   *
-   * @param buffer The buffer to read bytes from the file into
-   *
-   * @return The actual number of bytes read or -1 if end of file
-   *
-   * @exception IOException If an error occurs
-   */
-  public int read (byte[] buffer) throws IOException
-  {
-    return in.read (buffer);
-  }
-
-  /**
-   * This methods reads up to <code>len</code> bytes from the file into the
-   * specified array starting at position <code>offset</code> into the array.
-   *
-   * @param buffer The array to read the bytes into
-   * @param offset The index into the array to start storing bytes
-   * @param len The requested number of bytes to read
-   *
-   * @return The actual number of bytes read, or -1 if end of file
-   *
-   * @exception IOException If an error occurs
-   */
-  public int read (byte[] buffer, int offset, int len) throws IOException
-  {
-    return in.read (buffer, offset, len);
-  }
-
-  /**
-   * This method reads a Java boolean value from an input stream.  It does
-   * so by reading a single byte of data.  If that byte is zero, then the
-   * value returned is <code>false</code>  If the byte is non-zero, then
-   * the value returned is <code>true</code>
-   * <p>
-   * This method can read a <code>boolean</code> written by an object 
-   * implementing the
-   * <code>writeBoolean()</code> method in the <code>DataOutput</code> 
-   * interface.
-   *
-   * @return The <code>boolean</code> value read
-   *
-   * @exception EOFException If end of file is reached before reading the 
-   * boolean
-   * @exception IOException If any other error occurs
-   */
-  public final boolean readBoolean () throws IOException
-  {
-    return in.readBoolean ();
-  }
-
-  /**
-   * This method reads a Java byte value from an input stream.  The value
-   * is in the range of -128 to 127.
-   * <p>
-   * This method can read a <code>byte</code> written by an object 
-   * implementing the 
-   * <code>writeByte()</code> method in the <code>DataOutput</code> interface.
-   *
-   * @return The <code>byte</code> value read
-   *
-   * @exception EOFException If end of file is reached before reading the byte
-   * @exception IOException If any other error occurs
-   *
-   * @see DataOutput
-   */
-  public final byte readByte () throws IOException
-  {
-    return in.readByte ();
-  }
-
-  /**
-   * This method reads a Java <code>char</code> value from an input stream.  
-   * It operates by reading two bytes from the stream and converting them to 
-   * a single 16-bit Java <code>char</code>  The two bytes are stored most
-   * significant byte first (i.e., "big endian") regardless of the native
-   * host byte ordering. 
-   * <p>
-   * As an example, if <code>byte1</code> and <code>byte2</code> represent 
-   * the first
-   * and second byte read from the stream respectively, they will be
-   * transformed to a <code>char</code> in the following manner:
-   * <p>
-   * <code>(char)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF)</code>
-   * <p>
-   * This method can read a <code>char</code> written by an object 
-   * implementing the
-   * <code>writeChar()</code> method in the <code>DataOutput</code> interface.
-   *
-   * @return The <code>char</code> value read 
-   *
-   * @exception EOFException If end of file is reached before reading the char
-   * @exception IOException If any other error occurs
-   *
-   * @see DataOutput
-   */
-  public final char readChar () throws IOException
-  {
-    return in.readChar();
-  }
-
-  /**
-   * This method reads a Java double value from an input stream.  It operates
-   * by first reading a <code>logn</code> value from the stream by calling the
-   * <code>readLong()</code> method in this interface, then 
-   * converts that <code>long</code>
-   * to a <code>double</code> using the <code>longBitsToDouble</code> 
-   * method in the class <code>java.lang.Double</code>
-   * <p>
-   * This method can read a <code>double</code> written by an object 
-   * implementing the
-   * <code>writeDouble()</code> method in the <code>DataOutput</code> 
-   * interface.
-   *
-   * @return The <code>double</code> value read
-   *
-   * @exception EOFException If end of file is reached before reading 
-   * the double
-   * @exception IOException If any other error occurs
-   *
-   * @see java.lang.Double
-   * @see DataOutput
-   */
-  public final double readDouble () throws IOException
-  {
-    return in.readDouble ();
-  }
-
-  /**
-   * This method reads a Java float value from an input stream.  It operates
-   * by first reading an <code>int</code> value from the stream by calling the
-   * <code>readInt()</code> method in this interface, then converts 
-   * that <code>int</code>
-   * to a <code>float</code> using the <code>intBitsToFloat</code> method in 
-   * the class <code>java.lang.Float</code>
-   * <p>
-   * This method can read a <code>float</code> written by an object 
-   * implementing the
-   * <code>writeFloat()</code> method in the <code>DataOutput</code> interface.
-   *
-   * @return The <code>float</code> value read
-   *
-   * @exception EOFException If end of file is reached before reading the float
-   * @exception IOException If any other error occurs
-   *
-   * @see java.lang.Float
-   * @see DataOutput
-   */
-  public final float readFloat () throws IOException
-  {
-    return in.readFloat();
-  }
-
-  /**
-   * This method reads raw bytes into the passed array until the array is
-   * full.  Note that this method blocks until the data is available and
-   * throws an exception if there is not enough data left in the stream to
-   * fill the buffer
-   *
-   * @param buffer The buffer into which to read the data
-   *
-   * @exception EOFException If end of file is reached before filling the 
-   * buffer
-   * @exception IOException If any other error occurs
-   */
-  public final void readFully (byte[] buffer) throws IOException
-  {
-    in.readFully(buffer);
-  }
-
-  /**
-   * This method reads raw bytes into the passed array <code>buf</code> 
-   * starting
-   * <code>offset</code> bytes into the buffer.  The number of bytes read 
-   * will be
-   * exactly <code>len</code>  Note that this method blocks until the data is 
-   * available and throws an exception if there is not enough data left in 
-   * the stream to read <code>len</code> bytes.
-   *
-   * @param buffer The buffer into which to read the data
-   * @param offset The offset into the buffer to start storing data
-   * @param count The number of bytes to read into the buffer
-   *
-   * @exception EOFException If end of file is reached before filling 
-   * the buffer
-   * @exception IOException If any other error occurs
-   */
-  public final void readFully (byte[] buffer, int offset, int count)
-    throws IOException
-  {
-    in.readFully (buffer, offset, count);
-  }
-
-  /**
-   * This method reads a Java <code>int</code> value from an input stream
-   * It operates by reading four bytes from the stream and converting them to 
-   * a single Java <code>int</code>  The bytes are stored most
-   * significant byte first (i.e., "big endian") regardless of the native
-   * host byte ordering. 
-   * <p>
-   * As an example, if <code>byte1</code> through <code>byte4</code> 
-   * represent the first
-   * four bytes read from the stream, they will be
-   * transformed to an <code>int</code> in the following manner:
-   * <p>
-   * <code>(int)(((byte1 &amp; 0xFF) &lt;&lt; 24) + ((byte2 &amp; 0xFF) &lt;&lt; 16) + 
-   * ((byte3 &amp; 0xFF) &lt;&lt; 8) + (byte4 &amp; 0xFF)))</code>
-   * <p>
-   * The value returned is in the range of 0 to 65535.
-   * <p>
-   * This method can read an <code>int</code> written by an object 
-   * implementing the
-   * <code>writeInt()</code> method in the <code>DataOutput</code> interface.
-   *
-   * @return The <code>int</code> value read
-   *
-   * @exception EOFException If end of file is reached before reading the int
-   * @exception IOException If any other error occurs
-   *
-   * @see DataOutput
-   */
-  public final int readInt () throws IOException
-  {
-    return in.readInt();
-  }
-
-  /**
-   * This method reads the next line of text data from an input stream.
-   * It operates by reading bytes and converting those bytes to 
-   * <code>char</code>
-   * values by treating the byte read as the low eight bits of the 
-   * <code>char</code>
-   * and using <code>0</code> as the high eight bits.  Because of this, it does
-   * not support the full 16-bit Unicode character set.
-   * <p>
-   * The reading of bytes ends when either the end of file or a line terminator
-   * is encountered.  The bytes read are then returned as a <code>String</code>
-   * A line terminator is a byte sequence consisting of either 
-   * <code>\r</code> <code>\n</code> or <code>\r\n</code>  These 
-   * termination charaters are
-   * discarded and are not returned as part of the string.
-   * <p>
-   * This method can read data that was written by an object implementing the
-   * <code>writeLine()</code> method in <code>DataOutput</code>
-   *
-   * @return The line read as a <code>String</code>
-   *
-   * @exception IOException If an error occurs
-   *
-   * @see DataOutput
-   */
-  public final String readLine () throws IOException
-  {
-    return in.readLine ();
-  }
-
-  /**
-   * This method reads a Java long value from an input stream
-   * It operates by reading eight bytes from the stream and converting them to 
-   * a single Java <code>long</code>  The bytes are stored most
-   * significant byte first (i.e., "big endian") regardless of the native
-   * host byte ordering. 
-   * <p>
-   * As an example, if <code>byte1</code> through <code>byte8</code> 
-   * represent the first
-   * eight bytes read from the stream, they will be
-   * transformed to an <code>long</code> in the following manner:
-   * <p>
-   * <code>
-   * (long)((((long)byte1 &amp; 0xFF) &lt;&lt; 56) + (((long)byte2 &amp; 0xFF) &lt;&lt; 48) + 
-   * (((long)byte3 &amp; 0xFF) &lt;&lt; 40) + (((long)byte4 &amp; 0xFF) &lt;&lt; 32) + 
-   * (((long)byte5 &amp; 0xFF) &lt;&lt; 24) + (((long)byte6 &amp; 0xFF) &lt;&lt; 16) + 
-   * (((long)byte7 &amp; 0xFF) &lt;&lt; 8) + ((long)byte9 &amp; 0xFF)))</code>
-   * <p>
-   * The value returned is in the range of 0 to 65535.
-   * <p>
-   * This method can read an <code>long</code> written by an object 
-   * implementing the
-   * <code>writeLong()</code> method in the <code>DataOutput</code> interface.
-   *
-   * @return The <code>long</code> value read
-   *
-   * @exception EOFException If end of file is reached before reading the long
-   * @exception IOException If any other error occurs
-   *
-   * @see DataOutput
-   */
-  public final long readLong () throws IOException
-  {
-    return in.readLong();
-  }
-
-  /**
-   * This method reads a signed 16-bit value into a Java in from the stream.
-   * It operates by reading two bytes from the stream and converting them to 
-   * a single 16-bit Java <code>short</code>  The two bytes are stored most
-   * significant byte first (i.e., "big endian") regardless of the native
-   * host byte ordering. 
-   * <p>
-   * As an example, if <code>byte1</code> and <code>byte2</code> 
-   * represent the first
-   * and second byte read from the stream respectively, they will be
-   * transformed to a <code>short</code> in the following manner:
-   * <p>
-   * <code>(short)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF)</code>
-   * <p>
-   * The value returned is in the range of -32768 to 32767.
-   * <p>
-   * This method can read a <code>short</code> written by an object 
-   * implementing the
-   * <code>writeShort()</code> method in the <code>DataOutput</code> interface.
-   *
-   * @return The <code>short</code> value read
-   *
-   * @exception EOFException If end of file is reached before reading the value
-   * @exception IOException If any other error occurs
-   *
-   * @see DataOutput
-   */
-  public final short readShort () throws IOException
-  {
-    return in.readShort();
-  }
-
-  /**
-   * This method reads 8 unsigned bits into a Java <code>int</code> value 
-   * from the 
-   * stream. The value returned is in the range of 0 to 255.
-   * <p>
-   * This method can read an unsigned byte written by an object implementing 
-   * the <code>writeUnsignedByte()</code> method in the 
-   * <code>DataOutput</code> interface.
-   *
-   * @return The unsigned bytes value read as a Java <code>int</code>
-   *
-   * @exception EOFException If end of file is reached before reading the value
-   * @exception IOException If any other error occurs
-   *
-   * @see DataOutput
-   */
-  public final int readUnsignedByte () throws IOException
-  {
-    return in.readUnsignedByte();
-  }
-
-  /**
-   * This method reads 16 unsigned bits into a Java int value from the stream.
-   * It operates by reading two bytes from the stream and converting them to 
-   * a single Java <code>int</code>  The two bytes are stored most
-   * significant byte first (i.e., "big endian") regardless of the native
-   * host byte ordering. 
-   * <p>
-   * As an example, if <code>byte1</code> and <code>byte2</code> 
-   * represent the first
-   * and second byte read from the stream respectively, they will be
-   * transformed to an <code>int</code> in the following manner:
-   * <p>
-   * <code>(int)(((byte1 &amp; 0xFF) &lt;&lt; 8) + (byte2 &amp; 0xFF))</code>
-   * <p>
-   * The value returned is in the range of 0 to 65535.
-   * <p>
-   * This method can read an unsigned short written by an object implementing
-   * the <code>writeUnsignedShort()</code> method in the 
-   * <code>DataOutput</code> interface.
-   *
-   * @return The unsigned short value read as a Java <code>int</code>
-   *
-   * @exception EOFException If end of file is reached before reading the value
-   * @exception IOException If any other error occurs
-   */
-  public final int readUnsignedShort () throws IOException
-  {
-    return in.readUnsignedShort();
-  }
-
-  /**
-   * This method reads a <code>String</code> from an input stream that 
-   * is encoded in
-   * a modified UTF-8 format.  This format has a leading two byte sequence
-   * that contains the remaining number of bytes to read.  This two byte
-   * sequence is read using the <code>readUnsignedShort()</code> method of this
-   * interface.
-   * <p>
-   * After the number of remaining bytes have been determined, these bytes
-   * are read an transformed into <code>char</code> values.  
-   * These <code>char</code> values
-   * are encoded in the stream using either a one, two, or three byte format.
-   * The particular format in use can be determined by examining the first
-   * byte read.  
-   * <p>
-   * If the first byte has a high order bit of 0 then
-   * that character consists on only one byte.  This character value consists
-   * of seven bits that are at positions 0 through 6 of the byte.  As an
-   * example, if <code>byte1</code> is the byte read from the stream, it would
-   * be converted to a <code>char</code> like so:
-   * <p>
-   * <code>(char)byte1</code>
-   * <p>
-   * If the first byte has <code>110</code> as its high order bits, then the 
-   * character consists of two bytes.  The bits that make up the character
-   * value are in positions 0 through 4 of the first byte and bit positions
-   * 0 through 5 of the second byte.  (The second byte should have 
-   * 10 as its high order bits).  These values are in most significant
-   * byte first (i.e., "big endian") order.
-   * <p>
-   * As an example, if <code>byte1</code> and <code>byte2</code> 
-   * are the first two bytes
-   * read respectively, and the high order bits of them match the patterns
-   * which indicate a two byte character encoding, then they would be
-   * converted to a Java <code>char</code> like so:
-   * <p>
-   * <code>(char)(((byte1 & 0x1F) << 6) | (byte2 & 0x3F))</code>
-   * <p>
-   * If the first byte has a <code>1110</code> as its high order bits, then the
-   * character consists of three bytes.  The bits that make up the character
-   * value are in positions 0 through 3 of the first byte and bit positions
-   * 0 through 5 of the other two bytes.  (The second and third bytes should
-   * have <code>10</code> as their high order bits).  These values are in most
-   * significant byte first (i.e., "big endian") order.
-   * <p>
-   * As an example, if <code>byte1</code> <code>byte2</code> 
-   * and <code>byte3</code> are the
-   * three bytes read, and the high order bits of them match the patterns
-   * which indicate a three byte character encoding, then they would be
-   * converted to a Java <code>char</code> like so:
-   * <p>
-   * <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | 
-   * (byte3 & 0x3F))</code>
-   * <p>
-   * Note that all characters are encoded in the method that requires the
-   * fewest number of bytes with the exception of the character with the
-   * value of <code>&#92;u0000</code> which is encoded as two bytes.  This is 
-   * a  modification of the UTF standard used to prevent C language style
-   * <code>NUL</code> values from appearing in the byte stream.
-   * <p>
-   * This method can read data that was written by an object implementing the
-   * <code>writeUTF()</code> method in <code>DataOutput</code>
-   * 
-   * @return The <code>String</code> read
-   *
-   * @exception EOFException If end of file is reached before reading the 
-   * String
-   * @exception UTFDataFormatException If the data is not in UTF-8 format
-   * @exception IOException If any other error occurs
-   *
-   * @see DataOutput
-   */
-  public final String readUTF () throws IOException
-  {
-    return in.readUTF();
-  }
-
-  /**
-   * This method sets the current file position to the specified offset 
-   * from the beginning of the file.  Note that some operating systems will
-   * allow the file pointer to be set past the current end of the file.
-   *
-   * @param pos The offset from the beginning of the file at which to set 
-   * the file pointer
-   *
-   * @exception IOException If an error occurs
-   */
-  public void seek (long pos) throws IOException
-  {
-    ch.position(pos);
-  }
-
-  /**
-   * This method attempts to skip and discard the specified number of bytes 
-   * in the input stream.  It may actually skip fewer bytes than requested. 
-   * The actual number of bytes skipped is returned.  This method will not
-   * skip any bytes if passed a negative number of bytes to skip.
-   *
-   * @param numBytes The requested number of bytes to skip.
-   *
-   * @return The number of bytes actually skipped.
-   *
-   * @exception IOException If an error occurs.
-   */
-  public int skipBytes (int numBytes) throws IOException
-  {
-    if (numBytes < 0)
-      throw new IllegalArgumentException ("Can't skip negative bytes: " +
-                                          numBytes);
-    
-    if (numBytes == 0)
-      return 0;
-    
-    long oldPos = ch.position();
-    long newPos = oldPos + numBytes;
-    long size = ch.size();
-    if (newPos > size)
-      newPos = size;
-    ch.position(newPos);
-    return (int) (ch.position() - oldPos);
-  }
-
-  /**
-   * This method writes a single byte of data to the file. The file must
-   * be open for read-write in order for this operation to succeed.
-   *
-   * @param oneByte The byte of data to write, passed as an int.
-   *
-   * @exception IOException If an error occurs
-   */
-  public void write (int oneByte) throws IOException
-  {
-    out.write(oneByte);
-  }
-
-  /**
-   * This method writes all the bytes in the specified array to the file.
-   * The file must be open read-write in order for this operation to succeed.
-   *
-   * @param buffer The array of bytes to write to the file
-   */
-  public void write (byte[] buffer) throws IOException
-  {
-    out.write(buffer);
-  }
-
-  /**
-   * This method writes <code>len</code> bytes to the file from the specified
-   * array starting at index <code>offset</code> into the array.
-   *
-   * @param buffer The array of bytes to write to the file
-   * @param offset The index into the array to start writing file
-   * @param len The number of bytes to write
-   *
-   * @exception IOException If an error occurs
-   */
-  public void write (byte[] buffer, int offset, int len) throws IOException
-  {
-    out.write (buffer, offset, len);
-  }
-
-  /**
-   * This method writes a Java <code>boolean</code> to the underlying output 
-   * stream. For a value of <code>true</code>, 1 is written to the stream.
-   * For a value of <code>false</code>, 0 is written.
-   *
-   * @param val The <code>boolean</code> value to write to the stream
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeBoolean (boolean val) throws IOException
-  {
-    out.writeBoolean(val);
-  }
-
-  /**
-   * This method writes a Java <code>byte</code> value to the underlying
-   * output stream.
-   *
-   * @param val The <code>byte</code> to write to the stream, passed 
-   * as an <code>int</code>.
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeByte (int val) throws IOException
-  {
-    out.writeByte(val);
-  }
-
-  /**
-   * This method writes a Java <code>short</code> to the stream, high byte
-   * first.  This method requires two bytes to encode the value.
-   *
-   * @param val The <code>short</code> value to write to the stream, 
-   * passed as an <code>int</code>.
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeShort (int val) throws IOException
-  {
-    out.writeShort(val);
-  }
-
-  /**
-   * This method writes a single <code>char</code> value to the stream,
-   * high byte first.
-   *
-   * @param val The <code>char</code> value to write, passed as 
-   * an <code>int</code>.
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeChar (int val) throws IOException
-  {
-    out.writeChar(val);
-  }
-
-  /**
-   * This method writes a Java <code>int</code> to the stream, high bytes
-   * first.  This method requires four bytes to encode the value.
-   *
-   * @param val The <code>int</code> value to write to the stream.
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeInt (int val) throws IOException
-  {
-    out.writeInt(val);
-  }
-
-  /**
-   * This method writes a Java <code>long</code> to the stream, high bytes
-   * first.  This method requires eight bytes to encode the value.
-   *
-   * @param val The <code>long</code> value to write to the stream.
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeLong (long val) throws IOException
-  {
-    out.writeLong(val);
-  }
-
-  /**
-   * This method writes a Java <code>float</code> value to the stream.  This
-   * value is written by first calling the method 
-   * <code>Float.floatToIntBits</code>
-   * to retrieve an <code>int</code> representing the floating point number,
-   * then writing this <code>int</code> value to the stream exactly the same
-   * as the <code>writeInt()</code> method does.
-   *
-   * @param val The floating point number to write to the stream.
-   *
-   * @exception IOException If an error occurs
-   *
-   * @see #writeInt(int)
-   */
-  public final void writeFloat (float val) throws IOException
-  {
-    out.writeFloat(val);
-  }
-
-  /**
-   * This method writes a Java <code>double</code> value to the stream.  This
-   * value is written by first calling the method 
-   * <code>Double.doubleToLongBits</code>
-   * to retrieve an <code>long</code> representing the floating point number,
-   * then writing this <code>long</code> value to the stream exactly the same
-   * as the <code>writeLong()</code> method does.
-   *
-   * @param val The double precision floating point number to write to the 
-   * stream.
-   *
-   * @exception IOException If an error occurs
-   *
-   * @see #writeLong(long)
-   */
-  public final void writeDouble (double val) throws IOException
-  {
-    out.writeDouble(val);
-  }
-
-  /**
-   * This method writes all the bytes in a <code>String</code> out to the
-   * stream.  One byte is written for each character in the <code>String</code>.
-   * The high eight bits of each character are discarded.
-   *
-   * @param val The <code>String</code> to write to the stream
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeBytes (String val) throws IOException
-  {
-    out.writeBytes(val);
-  }
-  
-  /**
-   * This method writes all the characters in a <code>String</code> to the
-   * stream.  There will be two bytes for each character value.  The high
-   * byte of the character will be written first.
-   *
-   * @param val The <code>String</code> to write to the stream.
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeChars (String val) throws IOException
-  {
-    out.writeChars(val);
-  }
-  
-  /**
-   * This method writes a Java <code>String</code> to the stream in a modified
-   * UTF-8 format.  First, two bytes are written to the stream indicating the
-   * number of bytes to follow.  Note that this is the number of bytes in the
-   * encoded <code>String</code> not the <code>String</code> length.  Next
-   * come the encoded characters.  Each character in the <code>String</code>
-   * is encoded as either one, two or three bytes.  For characters in the
-   * range of <code>&#92;u0001</code> to <code>&#92;u007F</code>, 
-   * one byte is used.  The character
-   * value goes into bits 0-7 and bit eight is 0.  For characters in the range
-   * of <code>&#92;u0080</code> to <code>&#92;u007FF</code>, two 
-   * bytes are used.  Bits
-   * 6-10 of the character value are encoded bits 0-4 of the first byte, with
-   * the high bytes having a value of "110".  Bits 0-5 of the character value
-   * are stored in bits 0-5 of the second byte, with the high bits set to
-   * "10".  This type of encoding is also done for the null character
-   * <code>&#92;u0000</code>.  This eliminates any C style NUL character values
-   * in the output.  All remaining characters are stored as three bytes.
-   * Bits 12-15 of the character value are stored in bits 0-3 of the first
-   * byte.  The high bits of the first bytes are set to "1110".  Bits 6-11
-   * of the character value are stored in bits 0-5 of the second byte.  The
-   * high bits of the second byte are set to "10".  And bits 0-5 of the
-   * character value are stored in bits 0-5 of byte three, with the high bits
-   * of that byte set to "10".
-   *
-   * @param val The <code>String</code> to write to the output in UTF format
-   *
-   * @exception IOException If an error occurs
-   */
-  public final void writeUTF (String val) throws IOException
-  {
-    out.writeUTF(val);
-  }
-  
-  /**
-   * This method creates a java.nio.channels.FileChannel.
-   * Nio does not allow one to create a file channel directly.
-   * A file channel must be created by first creating an instance of
-   * Input/Output/RandomAccessFile and invoking the getChannel() method on it.
-   */
-  public final synchronized FileChannel getChannel ()
-  {
-    return ch;
-  }
-}
diff --git a/libjava/java/lang/InheritableThreadLocal.java b/libjava/java/lang/InheritableThreadLocal.java
deleted file mode 100644 (file)
index b58c5bc..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/* InheritableThreadLocal -- a ThreadLocal which inherits values across threads
-   Copyright (C) 2000, 2001, 2002, 2003, 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.lang;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * A ThreadLocal whose value is inherited by child Threads. The value of the
- * InheritableThreadLocal associated with the (parent) Thread is copied to
- * the new (child) Thread at the moment of creation.
- *
- * <p>It is possible to make the value associated with the child Thread a
- * function of the value that is associated with the parent Thread by
- * overriding the <code>childValue()</code> method. The utility of this class
- * is in transferring items like User ID or Transaction ID across threads
- * automatically.
- *
- * @author Mark Wielaard (mark@klomp.org)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see ThreadLocal
- * @since 1.2
- * @status updated to 1.4
- */
-public class InheritableThreadLocal extends ThreadLocal
-{
-  /**
-   * Maps Threads to a List of InheritableThreadLocals (the heritage of that
-   * Thread). Uses a WeakHashMap so if the Thread is garbage collected the
-   * List can be collected, too. Maps to a list in case the user overrides
-   * equals.
-   */
-  private static final Map threadMap
-         = Collections.synchronizedMap(new WeakHashMap());
-
-  /**
-   * Creates a new InheritableThreadLocal that has no values associated
-   * with it yet.
-   */
-  public InheritableThreadLocal()
-  {
-    Thread currentThread = Thread.currentThread();
-    // Note that we don't have to synchronize, as only this thread will
-    // ever modify the returned heritage and threadMap is a synchronizedMap.
-    List heritage = (List) threadMap.get(currentThread);
-    if (heritage == null)
-      {
-        heritage = new ArrayList();
-        threadMap.put(currentThread, heritage);
-      }
-    heritage.add(this);
-  }
-
-  /**
-   * Determines the value associated with a newly created child Thread as a
-   * function of the value associated with the currently executing (parent)
-   * Thread. The default implementation just returns the parentValue.
-   *
-   * @param parentValue the value of this object in the parent thread at
-   *        the moment of creation of the child
-   * @return the initial value for the child thread
-   */
-  protected Object childValue(Object parentValue)
-  {
-    return parentValue;
-  }
-
-  /**
-   * Generates the childValues of all <code>InheritableThreadLocal</code>s
-   * that are in the heritage of the current Thread for the newly created
-   * childThread. Should be called from the contructor Thread.
-   *
-   * @param childThread the newly created thread, to inherit from this thread
-   * @see Thread#Thread(ThreadGroup, Runnable, String)
-   */
-  static void newChildThread(Thread childThread)
-  {
-    // The currentThread is the parent of the new thread.
-    Thread parentThread = Thread.currentThread();
-    // Note that we don't have to synchronize, as only this thread will
-    // ever modify the returned heritage and threadMap is a synchronizedMap. 
-    ArrayList heritage = (ArrayList) threadMap.get(parentThread);
-    if (heritage != null)
-      {
-        threadMap.put(childThread, heritage.clone());
-        // Perform the inheritance.
-        Iterator it = heritage.iterator();
-        int i = heritage.size();
-        while (--i >= 0)
-          {
-            InheritableThreadLocal local = (InheritableThreadLocal) it.next();
-            Object parentValue = local.valueMap.get(parentThread);
-            if (parentValue != null)
-              {
-                Object childValue = local.childValue(parentValue == NULL
-                                                     ? null : parentValue);
-                local.valueMap.put(childThread, (childValue == null
-                                                 ? NULL : parentValue));
-              }
-          }
-      }
-  }
-}
index fc07f2b..7938498 100644 (file)
@@ -1,5 +1,5 @@
 /* Thread -- an independent thread of executable code
-   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation
 
 This file is part of GNU Classpath.
@@ -41,6 +41,8 @@ package java.lang;
 
 import gnu.gcj.RawData;
 import gnu.gcj.RawDataManaged;
+import gnu.java.util.WeakIdentityHashMap;
+import java.util.Map;
 
 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
  * "The Java Language Specification", ISBN 0-201-63451-1
@@ -125,6 +127,11 @@ public class Thread implements Runnable
   /** The context classloader for this Thread. */
   private ClassLoader contextClassLoader;
 
+  /** Thread local storage. Package accessible for use by
+    * InheritableThreadLocal.
+    */
+  WeakIdentityHashMap locals;
+
   // This describes the top-most interpreter frame for this thread.
   RawData interp_frame;
 
@@ -914,4 +921,18 @@ public class Thread implements Runnable
   private final native void initialize_native();
 
   private final native static String gen_name();
+
+  /**
+   * Returns the map used by ThreadLocal to store the thread local values.
+   */
+  static Map getThreadLocals()
+  {
+    Thread thread = currentThread();
+    Map locals = thread.locals;
+    if (locals == null)
+      {
+        locals = thread.locals = new WeakIdentityHashMap();
+      }
+    return locals;
+  }
 }
diff --git a/libjava/java/lang/ThreadLocal.java b/libjava/java/lang/ThreadLocal.java
deleted file mode 100644 (file)
index 9ef182e..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/* ThreadLocal -- a variable with a unique value per thread
-   Copyright (C) 2000, 2002, 2003 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.util.Collections;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-
-/**
- * ThreadLocal objects have a different state associated with every
- * Thread that accesses them. Every access to the ThreadLocal object
- * (through the <code>get()</code> and <code>set()</code> methods)
- * only affects the state of the object as seen by the currently
- * executing Thread.
- *
- * <p>The first time a ThreadLocal object is accessed on a particular
- * Thread, the state for that Thread's copy of the local variable is set by
- * executing the method <code>initialValue()</code>.
- * </p>
- *
- * <p>An example how you can use this:
- * </p>
- *
- * <pre>
- * class Connection
- * {
- *   private static ThreadLocal owner = new ThreadLocal()
- *     {
- *       public Object initialValue()
- *       {
- *         return("nobody");
- *       }
- *     };
- * ...
- * }
- * </pre>
- *
- * <p>Now all instances of connection can see who the owner of the currently
- * executing Thread is by calling <code>owner.get()</code>. By default any
- * Thread would be associated with 'nobody'. But the Connection object could
- * offer a method that changes the owner associated with the Thread on
- * which the method was called by calling <code>owner.put("somebody")</code>.
- * (Such an owner changing method should then be guarded by security checks.)
- * </p>
- *
- * <p>When a Thread is garbage collected all references to values of
- * the ThreadLocal objects associated with that Thread are removed.
- * </p>
- *
- * @author Mark Wielaard (mark@klomp.org)
- * @author Eric Blake (ebb9@email.byu.edu)
- * @since 1.2
- * @status updated to 1.4
- */
-public class ThreadLocal
-{
-  /**
-   * Placeholder to distinguish between uninitialized and null set by the
-   * user. Do not expose this to the public. Package visible for use by
-   * InheritableThreadLocal
-   */
-  static final Object NULL = new Object();
-
-  /**
-   * The stored value. Package visible for use by InheritableThreadLocal. */
-  Object value;
-       
-  /**
-   * Maps Threads to values. Uses a WeakHashMap so if a Thread is garbage
-   * collected the reference to the Value will disappear. A null value means
-   * uninitialized, while NULL means a user-specified null. Only the
-   * <code>set(Thread, Object)</code> and <code>get(Thread)</code> methods
-   * access it. Package visible for use by InheritableThreadLocal.
-   */
-  final Map valueMap = Collections.synchronizedMap(new WeakHashMap());
-       
-  /**
-   * Creates a ThreadLocal object without associating any value to it yet.
-   */
-  public ThreadLocal()
-  {
-  }
-
-  /**
-   * Called once per thread on the first invocation of get(), if set() was
-   * not already called. The default implementation returns <code>null</code>.
-   * Often, this method is overridden to create the appropriate initial object
-   * for the current thread's view of the ThreadLocal.
-   *
-   * @return the initial value of the variable in this thread
-   */
-  protected Object initialValue()
-  {
-    return null;
-  }
-
-  /**
-   * Gets the value associated with the ThreadLocal object for the currently
-   * executing Thread. If this is the first time the current thread has called
-   * get(), and it has not already called set(), the value is obtained by
-   * <code>initialValue()</code>.
-   *
-   * @return the value of the variable in this thread
-   */
-  public Object get()
-  {
-    Thread currentThread = Thread.currentThread();
-    // Note that we don't have to synchronize, as only this thread will
-    // ever modify the returned value and valueMap is a synchronizedMap.
-    Object value = valueMap.get(currentThread);
-    if (value == null)
-      {
-        value = initialValue();
-        valueMap.put(currentThread, value == null ? NULL : value);
-      }
-    return value == NULL ? null : value;
-  }
-
-  /**
-   * Sets the value associated with the ThreadLocal object for the currently
-   * executing Thread. This overrides any existing value associated with the
-   * current Thread and prevents <code>initialValue()</code> from being
-   * called if this is the first access to this ThreadLocal in this Thread.
-   *
-   * @param value the value to set this thread's view of the variable to
-   */
-  public void set(Object value)
-  {
-    // Note that we don't have to synchronize, as only this thread will
-    // ever modify the returned value and valueMap is a synchronizedMap.
-    valueMap.put(Thread.currentThread(), value == null ? NULL : value);
-  }
-}
index da9dcba..2879df8 100644 (file)
@@ -216,6 +216,9 @@ java::lang::Thread::finish_ ()
   // If a method cache was created, free it.
   _Jv_FreeMethodCache();
 
+  // Clear out thread locals.
+  locals = NULL;
+
   // Signal any threads that are waiting to join() us.
   _Jv_MutexLock (&nt->join_mutex);
 
diff --git a/libjava/java/security/AccessControlContext.java b/libjava/java/security/AccessControlContext.java
deleted file mode 100644 (file)
index 1c32931..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/* AccessControlContext.java --- Access Control Context Class
-   Copyright (C) 1999, 2004 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;
-
-/**
- * AccessControlContext makes system resource access decsion 
- * based on permission rights.  
- *
- * It is used for a specific context and has only one method
- * checkPermission. It is similar to AccessController except
- * that it makes decsions based on the current context instead
- * of the the current thread.
- *
- * It is created by call AccessController.getContext method.
- *
- * @author Mark Benvenuto
- * @since 1.2
- */
-public final class AccessControlContext
-{
-  private ProtectionDomain[] protectionDomains;
-  private DomainCombiner combiner;
-
-  /**
-   * Construct a new AccessControlContext with the specified
-   * ProtectionDomains. <code>context</code> must not be 
-   * null and duplicates will be removed.
-   *
-   * @param context The ProtectionDomains to use
-   */
-  public AccessControlContext(ProtectionDomain[] context)
-  {
-    int i, j, k, count = context.length, count2 = 0;
-    for (i = 0, j = 0; i < count; i++)
-      {
-       for (k = 0; k < i; k++)
-         if (context[k] == protectionDomains[i])
-           break;
-       if (k != i)             //it means previous loop did not complete
-         continue;
-
-       count2++;
-      }
-
-    protectionDomains = new ProtectionDomain[count2];
-    for (i = 0, j = 0; i < count2; i++)
-      {
-       for (k = 0; k < i; k++)
-         if (context[k] == protectionDomains[i])
-           break;
-       if (k != i)             //it means previous loop did not complete
-         continue;
-
-       protectionDomains[j++] = context[i];
-      }
-  }
-
-  /**
-   * Construct a new AccessControlContext with the specified
-   * ProtectionDomains and DomainCombiner
-   *
-   * @since 1.3
-   */
-  public AccessControlContext(AccessControlContext acc,
-                             DomainCombiner combiner)
-  {
-    this(acc.protectionDomains);
-    this.combiner = combiner;
-  }
-
-  /**
-   * Returns the Domain Combiner associated with the AccessControlContext
-   *
-   * @return the DomainCombiner
-   */
-  public DomainCombiner getDomainCombiner()
-  {
-    return combiner;
-  }
-
-  /**
-   * Determines whether or not the specific permission is granted
-   * depending on the context it is within. 
-   *
-   * @param perm a permission to check
-   *
-   * @throws AccessControlException if the permssion is not permitted
-   */
-  public void checkPermission(Permission perm) throws AccessControlException
-  {
-    for (int i = 0; i < protectionDomains.length; i++)
-      if (protectionDomains[i].implies(perm) == true)
-       return;
-
-    throw new AccessControlException("Permission not granted");
-  }
-
-  /**
-   * Checks if two AccessControlContexts are equal.
-   *
-   * It first checks if obj is an AccessControlContext class, and
-   * then checks if each ProtectionDomain matches.
-   *
-   * @param obj The object to compare this class to
-   *
-   * @return true if equal, false otherwise
-   */
-  public boolean equals(Object obj)
-  {
-    if (obj instanceof AccessControlContext)
-      {
-       AccessControlContext acc = (AccessControlContext) obj;
-
-       if (acc.protectionDomains.length != protectionDomains.length)
-         return false;
-
-       for (int i = 0; i < protectionDomains.length; i++)
-         if (acc.protectionDomains[i] != protectionDomains[i])
-           return false;
-        return true;
-      }
-    return false;
-  }
-
-  /**
-   * Computes a hash code of this class
-   *
-   * @return a hash code representing this class
-   */
-  public int hashCode()
-  {
-    int h = 0;
-    for (int i = 0; i < protectionDomains.length; i++)
-      h ^= protectionDomains[i].hashCode();
-
-    return h;
-  }
-}
diff --git a/libjava/java/util/logging/LogManager.java b/libjava/java/util/logging/LogManager.java
deleted file mode 100644 (file)
index 67dc76b..0000000
+++ /dev/null
@@ -1,819 +0,0 @@
-/* LogManager.java -- a class for maintaining Loggers and managing
-   configuration properties
-   Copyright (C) 2002 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.logging;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.ref.WeakReference;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-/**
- * The <code>LogManager</code> maintains a hierarchical namespace
- * of Logger objects and manages properties for configuring the logging
- * framework. There exists only one single <code>LogManager</code>
- * per virtual machine. This instance can be retrieved using the
- * static method {@link #getLogManager()}.
- *
- * <p><strong>Configuration Process:</strong> The global LogManager
- * object is created and configured when the class
- * <code>java.util.logging.LogManager</code> is initialized.
- * The configuration process includes the subsequent steps:
- *
- * <ul>
- * <li>If the system property <code>java.util.logging.manager</code>
- *     is set to the name of a subclass of
- *     <code>java.util.logging.LogManager</code>, an instance of
- *     that subclass is created and becomes the global LogManager.
- *     Otherwise, a new instance of LogManager is created.</li>
- * <li>The <code>LogManager</code> constructor tries to create
- *     a new instance of the class specified by the system
- *     property <code>java.util.logging.config.class</code>.
- *     Typically, the constructor of this class will call
- *     <code>LogManager.getLogManager().readConfiguration(java.io.InputStream)</code>
- *     for configuring the logging framework.
- *     The configuration process stops at this point if
- *     the system property <code>java.util.logging.config.class</code>
- *     is set (irrespective of whether the class constructor
- *     could be called or an exception was thrown).</li>
- *
- * <li>If the system property <code>java.util.logging.config.class</code>
- *     is <em>not</em> set, the configuration parameters are read in from
- *     a file and passed to
- *     {@link #readConfiguration(java.io.InputStream)}.
- *     The name and location of this file are specified by the system
- *     property <code>java.util.logging.config.file</code>.</li>
- * <li>If the system property <code>java.util.logging.config.file</code>
- *     is not set, however, the contents of the URL
- *     "{gnu.classpath.home.url}/logging.properties" are passed to
- *     {@link #readConfiguration(java.io.InputStream)}.
- *     Here, "{gnu.classpath.home.url}" stands for the value of
- *     the system property <code>gnu.classpath.home.url</code>.</li>
- * </ul>
- *
- * @author Sascha Brawer (brawer@acm.org)
- */
-public class LogManager
-{
-  /**
-   * The singleton LogManager instance.
-   */
-  private static LogManager logManager;
-
-  /**
-   * The registered named loggers; maps the name of a Logger to
-   * a WeakReference to it.
-   */
-  private Map loggers;
-  final Logger rootLogger;
-
-  /**
-   * The properties for the logging framework which have been
-   * read in last.
-   */
-  private Properties properties;
-
-  /**
-   * A delegate object that provides support for handling
-   * PropertyChangeEvents.  The API specification does not
-   * mention which bean should be the source in the distributed
-   * PropertyChangeEvents, but Mauve test code has determined that
-   * the Sun J2SE 1.4 reference implementation uses the LogManager
-   * class object. This is somewhat strange, as the class object
-   * is not the bean with which listeners have to register, but
-   * there is no reason for the GNU Classpath implementation to
-   * behave differently from the reference implementation in
-   * this case.
-   */
-  private final PropertyChangeSupport pcs = new PropertyChangeSupport( /* source bean */
-  LogManager.class);
-
-  protected LogManager()
-  {
-    if (logManager != null)
-      throw new IllegalStateException("there can be only one LogManager; use LogManager.getLogManager()");
-
-    logManager = this;
-    loggers = new java.util.HashMap();
-    rootLogger = new Logger("", null);
-    addLogger(rootLogger);
-
-    /* Make sure that Logger.global has the rootLogger as its parent.
-     *
-     * Logger.global is set during class initialization of Logger,
-     * which may or may not be before this code is being executed.
-     * For example, on the Sun 1.3.1 and 1.4.0 JVMs, Logger.global
-     * has been set before this code is being executed. In contrast,
-     * Logger.global still is null on GCJ 3.2.  Since the LogManager
-     * and Logger classes are mutually dependent, both behaviors are
-     * correct.
-     *
-     * This means that we cannot depend on Logger.global to have its
-     * value when this code executes, although that variable is final.
-     * Since Logger.getLogger will always return the same logger for
-     * the same name, the subsequent line works fine irrespective of
-     * the order in which classes are initialized.
-     */
-    Logger.getLogger("global").setParent(rootLogger);
-    Logger.getLogger("global").setUseParentHandlers(true);
-  }
-
-  /**
-   * Returns the globally shared LogManager instance.
-   */
-  public static LogManager getLogManager()
-  {
-    return logManager;
-  }
-
-  static
-    {
-      makeLogManager();
-
-      /* The Javadoc description of the class explains
-       * what is going on here.
-       */
-      Object configurator = createInstance(System.getProperty("java.util.logging.config.class"),
-                                           /* must be instance of */ Object.class);
-
-      try
-        {
-         if (configurator == null)
-           getLogManager().readConfiguration();
-        }
-      catch (IOException ex)
-        {
-         /* FIXME: Is it ok to ignore exceptions here? */
-        }
-    }
-
-  private static LogManager makeLogManager()
-  {
-    String managerClassName;
-    LogManager manager;
-
-    managerClassName = System.getProperty("java.util.logging.manager");
-    manager = (LogManager) createInstance(managerClassName, LogManager.class);
-    if (manager != null)
-      return manager;
-
-    if (managerClassName != null)
-      System.err.println("WARNING: System property \"java.util.logging.manager\""
-                         + " should be the name of a subclass of java.util.logging.LogManager");
-
-    return new LogManager();
-  }
-
-  /**
-   * Registers a listener which will be notified when the
-   * logging properties are re-read.
-   */
-  public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
-  {
-    /* do not register null. */
-    listener.getClass();
-
-    pcs.addPropertyChangeListener(listener);
-  }
-
-  /**
-   * Unregisters a listener.
-   *
-   * If <code>listener</code> has not been registered previously,
-   * nothing happens.  Also, no exception is thrown if
-   * <code>listener</code> is <code>null</code>.
-   */
-  public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
-  {
-    if (listener != null)
-      pcs.removePropertyChangeListener(listener);
-  }
-
-  /**
-   * Adds a named logger.  If a logger with the same name has
-   * already been registered, the method returns <code>false</code>
-   * without adding the logger.
-   *
-   * <p>The <code>LogManager</code> only keeps weak references
-   * to registered loggers.  Therefore, names can become available
-   * after automatic garbage collection.
-   *
-   * @param logger the logger to be added.
-   *
-   * @return <code>true</code>if <code>logger</code> was added,
-   *         <code>false</code> otherwise.
-   *
-   * @throws NullPointerException if <code>name</code> is
-   *         <code>null</code>.
-   */
-  public synchronized boolean addLogger(Logger logger)
-  {
-    /* To developers thinking about to remove the 'synchronized'
-     * declaration from this method: Please read the comment
-     * in java.util.logging.Logger.getLogger(String, String)
-     * and make sure that whatever you change wrt. synchronization
-     * does not endanger thread-safety of Logger.getLogger.
-     * The current implementation of Logger.getLogger assumes
-     * that LogManager does its synchronization on the globally
-     * shared instance of LogManager.
-     */
-    String name;
-    WeakReference ref;
-
-    /* This will throw a NullPointerException if logger is null,
-     * as required by the API specification.
-     */
-    name = logger.getName();
-
-    ref = (WeakReference) loggers.get(name);
-    if (ref != null)
-      {
-       if (ref.get() != null)
-         return false;
-
-       /* There has been a logger under this name in the past,
-        * but it has been garbage collected.
-        */
-       loggers.remove(ref);
-      }
-
-    /* Adding a named logger requires a security permission. */
-    if ((name != null) && ! name.equals(""))
-      checkAccess();
-
-    Logger parent = findAncestor(logger);
-    loggers.put(name, new WeakReference(logger));
-    if (parent != logger.getParent())
-      logger.setParent(parent);
-
-    /* It can happen that existing loggers should be children of
-     * the newly added logger. For example, assume that there
-     * already exist loggers under the names "", "foo", and "foo.bar.baz".
-     * When adding "foo.bar", the logger "foo.bar.baz" should change
-     * its parent to "foo.bar".
-     */
-    if (parent != rootLogger)
-      {
-       for (Iterator iter = loggers.keySet().iterator(); iter.hasNext();)
-         {
-           Logger possChild = (Logger) ((WeakReference) loggers.get(iter.next()))
-                              .get();
-           if ((possChild == null) || (possChild == logger)
-               || (possChild.getParent() != parent))
-             continue;
-
-           if (! possChild.getName().startsWith(name))
-             continue;
-
-           if (possChild.getName().charAt(name.length()) != '.')
-             continue;
-
-           possChild.setParent(logger);
-         }
-      }
-
-    return true;
-  }
-
-  /**
-   * Finds the closest ancestor for a logger among the currently
-   * registered ones.  For example, if the currently registered
-   * loggers have the names "", "foo", and "foo.bar", the result for
-   * "foo.bar.baz" will be the logger whose name is "foo.bar".
-   *
-   * @param child a logger for whose name no logger has been
-   *        registered.
-   *
-   * @return the closest ancestor for <code>child</code>,
-   *         or <code>null</code> if <code>child</code>
-   *         is the root logger.
-   *
-   * @throws NullPointerException if <code>child</code>
-   *         is <code>null</code>.
-   */
-  private synchronized Logger findAncestor(Logger child)
-  {
-    String childName = child.getName();
-    int childNameLength = childName.length();
-    Logger best = rootLogger;
-    int bestNameLength = 0;
-
-    Logger cand;
-    String candName;
-    int candNameLength;
-
-    if (child == rootLogger)
-      return null;
-
-    for (Iterator iter = loggers.keySet().iterator(); iter.hasNext();)
-      {
-       candName = (String) iter.next();
-       candNameLength = candName.length();
-
-       if (candNameLength > bestNameLength
-           && childNameLength > candNameLength
-           && childName.startsWith(candName)
-           && childName.charAt(candNameLength) == '.')
-         {
-           cand = (Logger) ((WeakReference) loggers.get(candName)).get();
-           if ((cand == null) || (cand == child))
-             continue;
-
-           bestNameLength = candName.length();
-           best = cand;
-         }
-      }
-
-    return best;
-  }
-
-  /**
-   * Returns a Logger given its name.
-   *
-   * @param name the name of the logger.
-   *
-   * @return a named Logger, or <code>null</code> if there is no
-   *     logger with that name.
-   *
-   * @throw java.lang.NullPointerException if <code>name</code>
-   *     is <code>null</code>.
-   */
-  public synchronized Logger getLogger(String name)
-  {
-    WeakReference ref;
-
-    /* Throw a NullPointerException if name is null. */
-    name.getClass();
-
-    ref = (WeakReference) loggers.get(name);
-    if (ref != null)
-      return (Logger) ref.get();
-    else
-      return null;
-  }
-
-  /**
-   * Returns an Enumeration of currently registered Logger names.
-   * Since other threads can register loggers at any time, the
-   * result could be different any time this method is called.
-   *
-   * @return an Enumeration with the names of the currently
-   *    registered Loggers.
-   */
-  public synchronized Enumeration getLoggerNames()
-  {
-    return Collections.enumeration(loggers.keySet());
-  }
-
-  /**
-   * Resets the logging configuration by removing all handlers for
-   * registered named loggers and setting their level to <code>null</code>.
-   * The level of the root logger will be set to <code>Level.INFO</code>.
-   *
-   * @throws SecurityException if a security manager exists and
-   *         the caller is not granted the permission to control
-   *         the logging infrastructure.
-   */
-  public synchronized void reset() throws SecurityException
-  {
-    /* Throw a SecurityException if the caller does not have the
-     * permission to control the logging infrastructure.
-     */
-    checkAccess();
-
-    properties = new Properties();
-
-    Iterator iter = loggers.values().iterator();
-    while (iter.hasNext())
-      {
-       WeakReference ref;
-       Logger logger;
-
-       ref = (WeakReference) iter.next();
-       if (ref != null)
-         {
-           logger = (Logger) ref.get();
-
-           if (logger == null)
-             iter.remove();
-           else if (logger != rootLogger)
-             logger.setLevel(null);
-         }
-      }
-
-    rootLogger.setLevel(Level.INFO);
-  }
-
-  /**
-   * Configures the logging framework by reading a configuration file.
-   * The name and location of this file are specified by the system
-   * property <code>java.util.logging.config.file</code>.  If this
-   * property is not set, the URL
-   * "{gnu.classpath.home.url}/logging.properties" is taken, where
-   * "{gnu.classpath.home.url}" stands for the value of the system
-   * property <code>gnu.classpath.home.url</code>.
-   *
-   * <p>The task of configuring the framework is then delegated to
-   * {@link #readConfiguration(java.io.InputStream)}, which will
-   * notify registered listeners after having read the properties.
-   *
-   * @throws SecurityException if a security manager exists and
-   *         the caller is not granted the permission to control
-   *         the logging infrastructure, or if the caller is
-   *         not granted the permission to read the configuration
-   *         file.
-   *
-   * @throws IOException if there is a problem reading in the
-   *         configuration file.
-   */
-  public synchronized void readConfiguration()
-    throws IOException, SecurityException
-  {
-    String path;
-    InputStream inputStream;
-
-    path = System.getProperty("java.util.logging.config.file");
-    if ((path == null) || (path.length() == 0))
-      {
-       String url = (System.getProperty("gnu.classpath.home.url")
-                    + "/logging.properties");
-       inputStream = new URL(url).openStream();
-      }
-    else
-      inputStream = new java.io.FileInputStream(path);
-
-    try
-      {
-       readConfiguration(inputStream);
-      }
-    finally
-      {
-       /* Close the stream in order to save
-        * resources such as file descriptors.
-        */
-       inputStream.close();
-      }
-  }
-
-  public synchronized void readConfiguration(InputStream inputStream)
-    throws IOException, SecurityException
-  {
-    Properties newProperties;
-    Enumeration keys;
-
-    checkAccess();
-    newProperties = new Properties();
-    newProperties.load(inputStream);
-    this.properties = newProperties;
-    keys = newProperties.propertyNames();
-
-    while (keys.hasMoreElements())
-      {
-       String key = ((String) keys.nextElement()).trim();
-       String value = newProperties.getProperty(key);
-
-       if (value == null)
-         continue;
-
-       value = value.trim();
-
-       if ("handlers".equals(key))
-         {
-           StringTokenizer tokenizer = new StringTokenizer(value);
-           while (tokenizer.hasMoreTokens())
-             {
-               String handlerName = tokenizer.nextToken();
-               try
-                 {
-                   Class handlerClass = Class.forName(handlerName);
-                   getLogger("").addHandler((Handler) handlerClass
-                                            .newInstance());
-                 }
-               catch (ClassCastException ex)
-                 {
-                   System.err.println("[LogManager] class " + handlerName
-                                      + " is not subclass of java.util.logging.Handler");
-                 }
-               catch (Exception ex)
-                 {
-                   //System.out.println("[LogManager.readConfiguration]"+ex);
-                 }
-             }
-         }
-
-       if (key.endsWith(".level"))
-         {
-           String loggerName = key.substring(0, key.length() - 6);
-           Logger logger = getLogger(loggerName);
-
-           if (logger == null)
-             {
-               logger = Logger.getLogger(loggerName);
-               addLogger(logger);
-             }
-           try
-             {
-               logger.setLevel(Level.parse(value));
-             }
-           catch (Exception _)
-             {
-               //System.out.println("[LogManager.readConfiguration] "+_);
-             }
-           continue;
-         }
-      }
-
-    /* The API specification does not talk about the
-     * property name that is distributed with the
-     * PropertyChangeEvent.  With test code, it could
-     * be determined that the Sun J2SE 1.4 reference
-     * implementation uses null for the property name.
-     */
-    pcs.firePropertyChange(null, null, null);
-  }
-
-  /**
-   * Returns the value of a configuration property as a String.
-   */
-  public synchronized String getProperty(String name)
-  {
-    if (properties != null)
-      return properties.getProperty(name);
-    else
-      return null;
-  }
-
-  /**
-   * Returns the value of a configuration property as an integer.
-   * This function is a helper used by the Classpath implementation
-   * of java.util.logging, it is <em>not</em> specified in the
-   * logging API.
-   *
-   * @param name the name of the configuration property.
-   *
-   * @param defaultValue the value that will be returned if the
-   *        property is not defined, or if its value is not an integer
-   *        number.
-   */
-  static int getIntProperty(String name, int defaultValue)
-  {
-    try
-      {
-       return Integer.parseInt(getLogManager().getProperty(name));
-      }
-    catch (Exception ex)
-      {
-       return defaultValue;
-      }
-  }
-
-  /**
-   * Returns the value of a configuration property as an integer,
-   * provided it is inside the acceptable range.
-   * This function is a helper used by the Classpath implementation
-   * of java.util.logging, it is <em>not</em> specified in the
-   * logging API.
-   *
-   * @param name the name of the configuration property.
-   *
-   * @param minValue the lowest acceptable value.
-   *
-   * @param maxValue the highest acceptable value.
-   *
-   * @param defaultValue the value that will be returned if the
-   *        property is not defined, or if its value is not an integer
-   *        number, or if it is less than the minimum value,
-   *        or if it is greater than the maximum value.
-   */
-  static int getIntPropertyClamped(String name, int defaultValue,
-                                   int minValue, int maxValue)
-  {
-    int val = getIntProperty(name, defaultValue);
-    if ((val < minValue) || (val > maxValue))
-      val = defaultValue;
-    return val;
-  }
-
-  /**
-   * Returns the value of a configuration property as a boolean.
-   * This function is a helper used by the Classpath implementation
-   * of java.util.logging, it is <em>not</em> specified in the
-   * logging API.
-   *
-   * @param name the name of the configuration property.
-   *
-   * @param defaultValue the value that will be returned if the
-   *        property is not defined, or if its value is neither
-   *        <code>"true"</code> nor <code>"false"</code>.
-   */
-  static boolean getBooleanProperty(String name, boolean defaultValue)
-  {
-    try
-      {
-       return (new Boolean(getLogManager().getProperty(name))).booleanValue();
-      }
-    catch (Exception ex)
-      {
-       return defaultValue;
-      }
-  }
-
-  /**
-   * Returns the value of a configuration property as a Level.
-   * This function is a helper used by the Classpath implementation
-   * of java.util.logging, it is <em>not</em> specified in the
-   * logging API.
-   *
-   * @param propertyName the name of the configuration property.
-   *
-   * @param defaultValue the value that will be returned if the
-   *        property is not defined, or if
-   *        {@link Level.parse(java.lang.String)} does not like
-   *        the property value.
-   */
-  static Level getLevelProperty(String propertyName, Level defaultValue)
-  {
-    try
-      {
-       return Level.parse(getLogManager().getProperty(propertyName));
-      }
-    catch (Exception ex)
-      {
-       return defaultValue;
-      }
-  }
-
-  /**
-   * Returns the value of a configuration property as a Class.
-   * This function is a helper used by the Classpath implementation
-   * of java.util.logging, it is <em>not</em> specified in the
-   * logging API.
-   *
-   * @param propertyName the name of the configuration property.
-   *
-   * @param defaultValue the value that will be returned if the
-   *        property is not defined, or if it does not specify
-   *        the name of a loadable class.
-   */
-  static final Class getClassProperty(String propertyName, Class defaultValue)
-  {
-    Class usingClass = null;
-
-    try
-      {
-       String propertyValue = logManager.getProperty(propertyName);
-       if (propertyValue != null)
-         usingClass = Class.forName(propertyValue);
-       if (usingClass != null)
-         return usingClass;
-      }
-    catch (Exception _)
-      {
-      }
-
-    return defaultValue;
-  }
-
-  static final Object getInstanceProperty(String propertyName, Class ofClass,
-                                          Class defaultClass)
-  {
-    Class klass = getClassProperty(propertyName, defaultClass);
-    if (klass == null)
-      return null;
-
-    try
-      {
-       Object obj = klass.newInstance();
-       if (ofClass.isInstance(obj))
-         return obj;
-      }
-    catch (Exception _)
-      {
-      }
-
-    if (defaultClass == null)
-      return null;
-
-    try
-      {
-       return defaultClass.newInstance();
-      }
-    catch (java.lang.InstantiationException ex)
-      {
-       throw new RuntimeException(ex.getMessage());
-      }
-    catch (java.lang.IllegalAccessException ex)
-      {
-       throw new RuntimeException(ex.getMessage());
-      }
-  }
-
-  /**
-   * An instance of <code>LoggingPermission("control")</code>
-   * that is shared between calls to <code>checkAccess()</code>.
-   */
-  private static final LoggingPermission controlPermission = new LoggingPermission("control",
-                                                                                   null);
-
-  /**
-   * Checks whether the current security context allows changing
-   * the configuration of the logging framework.  For the security
-   * context to be trusted, it has to be granted
-   * a LoggingPermission("control").
-   *
-   * @throws SecurityException if a security manager exists and
-   *         the caller is not granted the permission to control
-   *         the logging infrastructure.
-   */
-  public void checkAccess() throws SecurityException
-  {
-    SecurityManager sm = System.getSecurityManager();
-    if (sm != null)
-      sm.checkPermission(controlPermission);
-  }
-
-  /**
-   * Creates a new instance of a class specified by name.
-   *
-   * @param className the name of the class of which a new instance
-   *        should be created.
-   *
-   * @param ofClass the class to which the new instance should
-   *        be either an instance or an instance of a subclass.
-   *        FIXME: This description is just terrible.
-   *
-   * @return the new instance, or <code>null</code> if
-   *         <code>className</code> is <code>null</code>, if no class
-   *         with that name could be found, if there was an error
-   *         loading that class, or if the constructor of the class
-   *         has thrown an exception.
-   */
-  static final Object createInstance(String className, Class ofClass)
-  {
-    Class klass;
-
-    if ((className == null) || (className.length() == 0))
-      return null;
-
-    try
-      {
-       klass = Class.forName(className);
-       if (! ofClass.isAssignableFrom(klass))
-         return null;
-
-       return klass.newInstance();
-      }
-    catch (Exception _)
-      {
-       return null;
-      }
-    catch (java.lang.LinkageError _)
-      {
-       return null;
-      }
-  }
-}
index 01f3aed..18e0684 100644 (file)
@@ -1,5 +1,5 @@
 /* Logger.java -- a class for logging messages
-   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.
 
@@ -1170,4 +1170,18 @@ public class Logger
    * @return caller of the initial looging method
    */
   private native StackTraceElement getCallerStackFrame();
+
+  /**
+   * Reset and close handlers attached to this logger. This function is package
+   * private because it must only be available to the LogManager.
+   */
+  void resetLogger()
+  {
+    for (int i = 0; i < handlers.length; i++)
+      {
+        handlers[i].close();
+        handlerList.remove(handlers[i]);
+      }
+    handlers = getHandlers();
+  }
 }
index d3463d3..fbefe52 100644 (file)
@@ -4114,9 +4114,9 @@ classpath/java/io/Externalizable.java \
 java/io/File.java \
 classpath/java/io/FileDescriptor.java \
 classpath/java/io/FileFilter.java \
-java/io/FileInputStream.java \
+classpath/java/io/FileInputStream.java \
 classpath/java/io/FileNotFoundException.java \
-java/io/FileOutputStream.java \
+classpath/java/io/FileOutputStream.java \
 classpath/java/io/FilePermission.java \
 classpath/java/io/FileReader.java \
 classpath/java/io/FileWriter.java \
@@ -4156,7 +4156,7 @@ java/io/PrintStream.java \
 classpath/java/io/PrintWriter.java \
 classpath/java/io/PushbackInputStream.java \
 classpath/java/io/PushbackReader.java \
-java/io/RandomAccessFile.java \
+classpath/java/io/RandomAccessFile.java \
 classpath/java/io/Reader.java \
 classpath/java/io/SequenceInputStream.java \
 classpath/java/io/Serializable.java \
@@ -4221,7 +4221,7 @@ classpath/java/lang/IllegalStateException.java \
 classpath/java/lang/IllegalThreadStateException.java \
 classpath/java/lang/IncompatibleClassChangeError.java \
 classpath/java/lang/IndexOutOfBoundsException.java \
-java/lang/InheritableThreadLocal.java \
+classpath/java/lang/InheritableThreadLocal.java \
 classpath/java/lang/InstantiationError.java \
 classpath/java/lang/InstantiationException.java \
 classpath/java/lang/Integer.java \
@@ -4261,7 +4261,7 @@ java/lang/System.java \
 java/lang/Thread.java \
 classpath/java/lang/ThreadDeath.java \
 classpath/java/lang/ThreadGroup.java \
-java/lang/ThreadLocal.java \
+classpath/java/lang/ThreadLocal.java \
 classpath/java/lang/Throwable.java \
 classpath/java/lang/TypeNotPresentException.java \
 classpath/java/lang/UnknownError.java \
@@ -4741,7 +4741,7 @@ java/rmi/server.list: $(java_rmi_server_source_files)
 
 
 java_security_source_files = \
-java/security/AccessControlContext.java \
+classpath/java/security/AccessControlContext.java \
 classpath/java/security/AccessControlException.java \
 java/security/AccessController.java \
 classpath/java/security/AlgorithmParameterGenerator.java \
@@ -5150,7 +5150,7 @@ classpath/java/util/logging/Filter.java \
 classpath/java/util/logging/Formatter.java \
 classpath/java/util/logging/Handler.java \
 classpath/java/util/logging/Level.java \
-java/util/logging/LogManager.java \
+classpath/java/util/logging/LogManager.java \
 classpath/java/util/logging/LogRecord.java \
 java/util/logging/Logger.java \
 classpath/java/util/logging/LoggingPermission.java \