changeset 700:693805fade68

More small spec fixes for b96: - AsynchronousDatagramChannel send/receive methods should not throw pending exceptions - Restore FileSystem#supportedFileAttributeViews - New Formatter ctors not needed - Misc. typos and examples
author alanb
date Thu, 09 Oct 2008 11:23:07 +0100
parents 44edf677e97e
children bd88f23c2b02
files src/share/classes/java/nio/channels/AsynchronousDatagramChannel.java src/share/classes/java/nio/file/FileSystem.java src/share/classes/java/nio/file/OpenOption.java src/share/classes/java/nio/file/Path.java src/share/classes/java/nio/file/WatchKey.java src/share/classes/java/nio/file/attribute/AclFileAttributeView.java src/share/classes/java/nio/file/attribute/Attributes.java src/share/classes/java/nio/file/attribute/FileOwnerAttributeView.java src/share/classes/java/nio/file/attribute/NamedAttributeView.java src/share/classes/java/util/Formatter.java src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystem.java src/solaris/classes/sun/nio/fs/LinuxFileSystem.java src/solaris/classes/sun/nio/fs/SolarisFileSystem.java src/solaris/classes/sun/nio/fs/UnixCopyFile.java src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java src/solaris/classes/sun/nio/fs/UnixFileModeAttribute.java src/solaris/classes/sun/nio/fs/UnixFileSystem.java src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java src/windows/classes/sun/nio/fs/WindowsFileSystem.java test/java/nio/channels/AsynchronousDatagramChannel/Basic.java test/java/nio/file/FileSystem/Basic.java test/java/nio/file/spi/TestProvider.java
diffstat 23 files changed, 238 insertions(+), 228 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/nio/channels/AsynchronousDatagramChannel.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/channels/AsynchronousDatagramChannel.java	Thu Oct 09 11:23:07 2008 +0100
@@ -172,8 +172,8 @@
      * @throws  UnsupportedOperationException
      *          If the specified protocol family is not supported. For example,
      *          suppose the parameter is specified as {@link
-     *          java.net.StandardProtocolFamily#INET6 StandardProtocolFamily.INET6}
-     *          but IPv6 is not enabled on the platform.
+     *          java.net.StandardProtocolFamily#INET6 INET6} but IPv6 is not
+     *          enabled on the platform.
      * @throws  ShutdownChannelGroupException
      *          The specified group is shutdown
      * @throws  IOException
@@ -221,6 +221,7 @@
      *          SecurityManager#checkListen checkListen} method denies the
      *          operation
      */
+    @Override
     public abstract AsynchronousDatagramChannel bind(SocketAddress local)
         throws IOException;
 
@@ -229,6 +230,7 @@
      * @throws  ClosedChannelException                  {@inheritDoc}
      * @throws  IOException                             {@inheritDoc}
      */
+    @Override
     public abstract <T> AsynchronousDatagramChannel setOption(SocketOption<T> name, T value)
         throws IOException;
 
@@ -360,8 +362,6 @@
      *
      * @throws  IllegalArgumentException
      *          If the timeout is negative or the buffer is read-only
-     * @throws  ReadPendingException
-     *          If a read operation is already in progress on this channel
      */
     public abstract <A> Future<SocketAddress> receive(ByteBuffer dst,
                                                       long timeout,
@@ -392,8 +392,6 @@
      *
      * @throws  IllegalArgumentException
      *          If the buffer is read-only
-     * @throws  ReadPendingException
-     *          If a read operation is already in progress on this channel
      */
     public final <A> Future<SocketAddress> receive(ByteBuffer dst,
                                                    A attachment,
@@ -422,8 +420,6 @@
      *
      * @throws  IllegalArgumentException
      *          If the buffer is read-only
-     * @throws  ReadPendingException
-     *          If a read operation is already in progress on this channel
      */
     public final <A> Future<SocketAddress> receive(ByteBuffer dst) {
         return receive(dst, 0L, TimeUnit.MILLISECONDS, null, null);
@@ -474,8 +470,6 @@
      * @throws  IllegalArgumentException
      *          If the channel's socket is connected and is connected to an
      *          address that is not equal to {@code target}
-     * @throws  WritePendingException
-     *          If a write operation is already in progress on this channel
      * @throws  SecurityException
      *          If a security manager has been installed and it does not permit
      *          datagrams to be sent to the given address
@@ -519,8 +513,6 @@
      * @throws  IllegalArgumentException
      *          If the channel's socket is connected and is connected to an
      *          address that is not equal to {@code target}
-     * @throws  WritePendingException
-     *          If a write operation is already in progress on this channel
      * @throws  SecurityException
      *          If a security manager has been installed and it does not permit
      *          datagrams to be sent to the given address
@@ -562,8 +554,6 @@
      * @throws  IllegalArgumentException
      *          If the channel's socket is connected and is connected to an
      *          address that is not equal to {@code target}
-     * @throws  WritePendingException
-     *          If a write operation is already in progress on this channel
      * @throws  SecurityException
      *          If a security manager has been installed and it does not permit
      *          datagrams to be sent to the given address
@@ -607,8 +597,6 @@
      *
      * @throws  IllegalArgumentException
      *          If the timeout is negative or buffer is read-only
-     * @throws  ReadPendingException
-     *          If a read operation is already in progress on this channel
      * @throws  NotYetConnectedException
      *          If this channel is not connected
      */
@@ -619,7 +607,6 @@
                                              CompletionHandler<Integer,? super A> handler);
 
     /**
-     * @throws  ReadPendingException       {@inheritDoc}
      * @throws  NotYetConnectedException
      *          If this channel is not connected
      */
@@ -632,7 +619,6 @@
     }
 
     /**
-     * @throws  ReadPendingException       {@inheritDoc}
      * @throws  NotYetConnectedException
      *          If this channel is not connected
      */
@@ -678,8 +664,6 @@
      *
      * @throws  IllegalArgumentException
      *          If the timeout is negative
-     * @throws  WritePendingException
-     *          If a read operation is already in progress on this channel
      * @throws  NotYetConnectedException
      *          If this channel is not connected
      */
@@ -689,7 +673,6 @@
                                               A attachment,
                                               CompletionHandler<Integer,? super A> handler);
     /**
-     * @throws  WritePendingException       {@inheritDoc}
      * @throws  NotYetConnectedException
      *          If this channel is not connected
      */
@@ -702,7 +685,6 @@
     }
 
     /**
-     * @throws  WritePendingException       {@inheritDoc}
      * @throws  NotYetConnectedException
      *          If this channel is not connected
      */
--- a/src/share/classes/java/nio/file/FileSystem.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/FileSystem.java	Thu Oct 09 11:23:07 2008 +0100
@@ -27,6 +27,7 @@
 
 import java.nio.file.attribute.*;
 import java.nio.file.spi.FileSystemProvider;
+import java.util.Set;
 import java.io.Closeable;
 import java.io.IOException;
 
@@ -205,11 +206,40 @@
      * directory corresponds to the root directory of a distinct file hierarchy
      * is implementation specific.
      *
+     * <p> <b>Usage Example:</b>
+     * Suppose we want to print the space usage for all file stores:
+     * <pre>
+     *     for (FileStore store: FileSystems.getDefault().getFileStores()) {
+     *         FileStoreSpaceAttributes attrs = Attributes.readFileStoreSpaceAttributes(store);
+     *         long total = attrs.totalSpace() / 1024;
+     *         long used = (attrs.totalSpace() - attrs.unallocatedSpace()) / 1024;
+     *         long avail = attrs.usableSpace() / 1024;
+     *         System.out.format("%-20s %12d %12d %12d%n", store, total, used, avail);
+     *     }
+     * </pre>
+     *
      * @return  An object to iterate over the backing file stores
      */
     public abstract Iterable<FileStore> getFileStores();
 
     /**
+     * Returns the set of the {@link FileAttributeView#name names} of the file
+     * attribute views supported by this {@code FileSystem}.
+     *
+     * <p> The {@link BasicFileAttributeView} is required to be supported and
+     * therefore the set contains at least one element, "basic".
+     *
+     * <p> The {@link FileStore#supportsFileAttributeView(String)
+     * supportsFileAttributeView(String)} method may be used to test if an
+     * underlying {@link FileStore} supports the file attributes identified by a
+     * file attribute view.
+     *
+     * @return  An unmodifiable set of the names of the supported file attribute
+     *          views
+     */
+    public abstract Set<String> supportedFileAttributeViews();
+
+    /**
      * Converts a path string to a {@code Path}.
      *
      * <p> The parsing and conversion to a path object is inherently
@@ -358,10 +388,17 @@
      * Returns the {@code UserPrincipalLookupService} for this file system.
      * The resulting lookup service may be used to lookup user or group names.
      *
+     * <p> <b>Usage Example:</b>
+     * Suppose we want to make "joe" the owner of a file:
+     * <pre>
+     *     Path file = ...
+     *     UserPrincipal joe = file.getFileSystem().getUserPrincipalLookupService()
+     *         .lookupPrincipalByName("joe");
+     *     Attributes.setOwner(file, joe);
+     * </pre>
+     *
      * @return  The {@code UserPrincipalLookupService} for this file system,
      *          or {@code null} if the file system does not have a lookup service
-     *
-     * @see Attributes#setOwner
      */
     public abstract UserPrincipalLookupService getUserPrincipalLookupService();
 
--- a/src/share/classes/java/nio/file/OpenOption.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/OpenOption.java	Thu Oct 09 11:23:07 2008 +0100
@@ -29,9 +29,11 @@
  * An object that configures how to open or create a file.
  *
  * <p> Objects of this type are used by methods such as {@link
- * FileRef#newByteChannel newByteChannel} or {@link
- * java.nio.channels.FileChannel#open FileChannel.open} when opening or creating
- * a file.
+ * Path#newOutputStream(OpenOption[]) newOutputStream}, {@link
+ * FileRef#newByteChannel newByteChannel}, {@link
+ * java.nio.channels.FileChannel#open FileChannel.open}, and {@link
+ * java.nio.channels.AsynchronousFileChannel#open AsynchronousFileChannel.open}
+ * when opening or creating a file.
  *
  * <p> The {@link StandardOpenOption} enumeration type defines the
  * <i>standard</i> options.
--- a/src/share/classes/java/nio/file/Path.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/Path.java	Thu Oct 09 11:23:07 2008 +0100
@@ -95,7 +95,15 @@
  * The <a href="attribute/package-summary.html">{@code java.nio.file.attribute}</a>
  * package provides access to file attributes or <em>meta-data</em> associated
  * with files. The {@link Attributes Attributes} class defines methods that
- * operate on or return file attributes.
+ * operate on or return file attributes. For example, the file type, size,
+ * timestamps, and other <em>basic</em> meta-data is obtained, in bulk, by
+ * invoking the {@link Attributes#readBasicFileAttributes
+ * Attributes.readBasicFileAttributes} method:
+ * <pre>
+ *     Path file = ...
+ *     boolean followLinks = ...
+ *     BasicFileAttributes attrs = Attributes.readBasicFileAttributes(file, followLinks);
+ * </pre>
  *
  * <a name="interop"><h4>Interoperability</h4></a>
  *
@@ -957,8 +965,8 @@
      * stream is a {@link SecureDirectoryStream}.
      *
      * <p> <b>Usage Example:</b>
-     * Suppose we require to iterate over the files in a directory that are
-     * larger than 8KB.
+     * Suppose we want to iterate over the files in a directory that are
+     * larger than 8K.
      * <pre>
      *     Path dir = ...
      *     DirectoryStream&lt;Path&gt; stream = dir.newDirectoryStream(new DirectoryStream.Filter&lt;Path&gt;() {
@@ -1250,7 +1258,7 @@
      *
      * <p> This method opens or creates a file in exactly the manner specified
      * by the {@link Path#newByteChannel(Set,FileAttribute[]) newByteChannel}
-     * method except that {@link StandardOpenOption#READ READ} option may not
+     * method except that the {@link StandardOpenOption#READ READ} option may not
      * be present in the array of open options. If no open options are present
      * then this method creates a new file for writing or truncates an existing
      * file.
--- a/src/share/classes/java/nio/file/WatchKey.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/WatchKey.java	Thu Oct 09 11:23:07 2008 +0100
@@ -30,7 +30,7 @@
 /**
  * A key representing the registration of an object with a {@link WatchService}.
  *
- * <p> A watch key is created when a {@link Watchable watchable} object is
+ * <p> A watch key is created when a {@link Watchable Watchable} object is
  * registered with a watch service. The key remains {@link #isValid valid} until:
  * <ol>
  *   <li> It is cancelled, explicitly, by invoking its {@link #cancel cancel}
--- a/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java	Thu Oct 09 11:23:07 2008 +0100
@@ -27,7 +27,6 @@
 
 import java.nio.file.*;
 import java.util.List;
-import java.util.Map;
 import java.io.IOException;
 
 /**
@@ -123,7 +122,7 @@
  *
  * <p> Implementations supporting this attribute view may also support setting
  * the initial ACL when creating a file or directory. The initial ACL
- * may be provided to method such as {@link Path#createFile createFile} or {@link
+ * may be provided to methods such as {@link Path#createFile createFile} or {@link
  * Path#createDirectory createDirectory} as an {@link FileAttribute} with {@link
  * FileAttribute#name name} {@code "acl:acl"} and a {@link FileAttribute#value
  * value} that is the list of {@code AclEntry} objects.
--- a/src/share/classes/java/nio/file/attribute/Attributes.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/Attributes.java	Thu Oct 09 11:23:07 2008 +0100
@@ -32,7 +32,7 @@
 
 /**
  * This class consists exclusively of static methods that operate on or return
- * the attributes of files of file stores.
+ * the attributes of files or file stores.
  *
  * @since 1.7
  */
@@ -76,7 +76,7 @@
      * attribute view that identifies the basic set of file attributes common to
      * many file systems. <i>attribute-name</i> is the name of the attribute
      * within the set. For example, invoking this method with the parameter
-     * {@code "posix:permissions"} will set the file permissions.
+     * {@code "posix:permissions"} attemps to set the file's permissions.
      *
      * @param   file
      *          A file reference that locates the file
@@ -117,6 +117,12 @@
     /**
      * Reads the value of a file attribute.
      *
+     * <p> The {@code followLinks} parameter indicates if symbolic links
+     * should be followed and is only used when the file is a symbolic link.
+     * When the value of the parameter is {@code true}, the file attribute of
+     * the file that is the target of the link is returned; otherwise the
+     * file attribute of the symbolic link is returned.
+     *
      * <p> The {@code attribute} parameter identifies the attribute to be read
      * and takes the form:
      * <blockquote>
@@ -129,8 +135,7 @@
      * FileAttributeView} that identifies a set of file attributes. If not
      * specified then it defaults to {@code "basic"}, the name of the file
      * attribute view that identifies the basic set of file attributes common to
-     * many file systems. <i>attribute-name</i> is the name of the attribute
-     * within the set.
+     * many file systems. <i>attribute-name</i> is the name of the attribute.
      *
      * <p> <b>Usage Example:</b>
      * Suppose we require the user ID of the file owner on a system that
@@ -173,6 +178,12 @@
     /**
      * Reads a set of file attributes as a bulk operation.
      *
+     * <p> The {@code followLinks} parameter indicates if symbolic links
+     * should be followed and is only used when the file is a symbolic link.
+     * When the value of the parameter is {@code true}, the file attributes of
+     * the file that is the target of the link are returned; otherwise the
+     * file attributes of the symbolic link are returned.
+     *
      * <p> The {@code attributes} parameter identifies the attributes to be read
      * and takes the form:
      * <blockquote>
@@ -259,16 +270,22 @@
     }
 
     /**
-     * Reads the basic file attributes of the given file.
+     * Reads the basic file attributes of a file.
+     *
+     * <p> The {@code followLinks} parameter indicates if symbolic links
+     * should be followed and is only used when the file is a symbolic link.
+     * When the value of the parameter is {@code true}, the file attributes of
+     * the file that is the target of the link are returned; otherwise the
+     * file attributes of the symbolic link are returned. To determine if a file
+     * a symbolic link then invoke this method with the {@code followLinks}
+     * parameter set to {@code false} and use the {@link
+     * BasicFileAttributes#isSymbolicLink isSymbolicLink} method. The {@code
+     * followLinks} is ignored by implementations that do not support symbolic
+     * links.
      *
      * <p> It is implementation specific if all file attributes are read as an
      * atomic operation with respect to other file system operations.
      *
-     * <p> The {@code followLinks} indicates if the symbolic links should be
-     * followed. When the value of this parameter is {@code false}, and the
-     * file is a link, then this method reads the attributes of the link. This
-     * parameter is ignored by implementations that do not support symbolic links.
-     *
      * @param   file
      *          A file reference that locates the file
      * @param   followLinks
@@ -294,20 +311,21 @@
     }
 
     /**
-     * Reads the POSIX file attributes of the given file.
+     * Reads the POSIX file attributes of a file.
      *
-     * <p> The {@code file} parameter is a file reference to locate the file.
-     * It supports the {@link PosixFileAttributeView} that provides access to a
+     * <p> The {@code file} parameter locates a file that supports the {@link
+     * PosixFileAttributeView}. This file attribute view provides access to a
      * subset of the file attributes commonly associated with files on file
      * systems used by operating systems that implement the Portable Operating
      * System Interface (POSIX) family of standards. It is implementation
      * specific if all file attributes are read as an atomic operation with
      * respect to other file system operations.
      *
-     * <p> The {@code followLinks} indicates if the symbolic links should be
-     * followed. When the value of this parameter is {@code false}, and the
-     * file is a link, then this method reads the attributes of the link. This
-     * parameter is ignored by implementations that do not support symbolic links.
+     * <p> The {@code followLinks} parameter indicates if symbolic links
+     * should be followed and is only used when the file is a symbolic link.
+     * When the value of the parameter is {@code true}, the file attributes of
+     * the file that is the target of the link are returned; otherwise the
+     * file attributes of the symbolic link are returned.
      *
      * @param   file
      *          A file reference that locates the file
@@ -340,17 +358,20 @@
     }
 
     /**
-     * Reads the DOS file attributes of the given file.
+     * Reads the DOS file attributes of a file.
      *
-     * <p> The {@code file} parameter is a file reference to locate the file.
-     * It supports the {@link DosFileAttributeView} that provides access to
+     * <p> The {@code file} parameter locates a file that supports the {@link
+     * DosFileAttributeView}. This file attribute view provides access to
      * legacy "DOS" attributes supported by the file systems such as File
-     * Allocation Table (FAT), commonly used in <em>consumer devices</em>.
+     * Allocation Table (FAT), commonly used in <em>consumer devices</em>. It is
+     * implementation specific if all file attributes are read as an atomic
+     * operation with respect to other file system operations.
      *
-     * <p> The {@code followLinks} indicates if the symbolic links should be
-     * followed. When the value of this parameter is {@code false}, and the
-     * file is a link, then this method reads the attributes of the link. This
-     * parameter is ignored by implementations that do not support symbolic links.
+     * <p> The {@code followLinks} parameter indicates if symbolic links
+     * should be followed and is only used when the file is a symbolic link.
+     * When the value of the parameter is {@code true}, the file attributes of
+     * the file that is the target of the link are returned; otherwise the
+     * file attributes of the symbolic link are returned.
      *
      * @param   file
      *          A file reference that locates the file
@@ -382,11 +403,11 @@
     }
 
     /**
-     * Returns the owner of the given file.
+     * Returns the owner of a file.
      *
-     * <p> The {@code file} parameter is a file reference to locate the file. It
-     * supports the {@link FileOwnerAttributeView} that provides access to the
-     * file attribute that is the owner of the file.
+     * <p> The {@code file} parameter locates a file that supports the {@link
+     * FileOwnerAttributeView}. This file attribute view provides access to
+     * a file attribute that is the owner of the file.
      *
      * @param   file
      *          A file reference that locates the file
@@ -416,9 +437,9 @@
     /**
      * Updates the file owner.
      *
-     * <p> The {@code file} parameter is a file reference to locate the file. It
-     * supports the {@link FileOwnerAttributeView} that provides access to the
-     * file attribute that is the owner of the file.
+     * <p> The {@code file} parameter locates a file that supports the {@link
+     * FileOwnerAttributeView}. This file attribute view provides access to
+     * a file attribute that is the owner of the file.
      *
      * @param   file
      *          A file reference that locates the file
@@ -448,14 +469,12 @@
     }
 
     /**
-     * Reads the Access Control List (ACL) of a given file.
+     * Reads a file's Access Control List (ACL).
      *
-     * <p> The {@code file} parameter is a reference to an existing file. It
-     * supports the {@link AclFileAttributeView} that provides access to ACLs
+     * <p> The {@code file} parameter locates a file that supports the {@link
+     * AclFileAttributeView}. This file attribute view provides access to ACLs
      * based on the ACL model specified in
      *  <a href="http://www.ietf.org/rfc/rfc3530.txt"><i>RFC&nbsp;3530</i></a>.
-     * Its {@link AclFileAttributeView#getAcl getAcl} method is invoked to read
-     * the ACL.
      *
      * @param   file
      *          A file reference that locates the file
@@ -472,6 +491,8 @@
      *          installed, it denies {@link RuntimePermission}<tt>("accessUserInformation")</tt>
      *          or its {@link SecurityManager#checkRead(String) checkRead} method
      *          denies read access to the file.
+     *
+     * @see AclFileAttributeView#getAcl
      */
     public static List<AclEntry> getAcl(FileRef file) throws IOException {
         AclFileAttributeView view =
@@ -484,12 +505,10 @@
     /**
      * Updates a file's Access Control List (ACL).
      *
-     * <p> The {@code file} parameter is a reference to an existing file. It
-     * supports the {@link AclFileAttributeView} that provides access to ACLs
+     * <p> The {@code file} parameter locates a file that supports the {@link
+     * AclFileAttributeView}. This file attribute view provides access to ACLs
      * based on the ACL model specified in
      *  <a href="http://www.ietf.org/rfc/rfc3530.txt"><i>RFC&nbsp;3530</i></a>.
-     * Its {@link AclFileAttributeView#setAcl setAcl} method is invoked to set
-     * the ACL.
      *
      * @param   file
      *          A file reference that locates the file
@@ -505,6 +524,8 @@
      *          installed, it denies {@link RuntimePermission}<tt>("accessUserInformation")</tt>
      *          or its {@link SecurityManager#checkWrite(String) checkWrite}
      *          method denies write access to the file.
+     *
+     * @see AclFileAttributeView#setAcl
      */
     public static void setAcl(FileRef file, List<AclEntry> acl)
         throws IOException
@@ -598,7 +619,7 @@
     }
 
     /**
-     * Sets the POSIX file permissions of the given file.
+     * Sets a file's POSIX permissions.
      *
      * <p> The {@code file} parameter is a reference to an existing file. It
      * supports the {@link PosixFileAttributeView} that provides access to file
@@ -640,12 +661,12 @@
     /**
      * Reads the space attributes of a file store.
      *
-     * <p> The {@code fs} parameter is a file store that supports the
+     * <p> The {@code store} parameter is a file store that supports the
      * {@link FileStoreSpaceAttributeView} providing access to the space related
      * attributes of the file store. It is implementation specific if all attributes
      * are read as an atomic operation with respect to other file system operations.
      *
-     * @param   fs
+     * @param   store
      *          The file store
      *
      * @return  The file store space attributes
@@ -661,12 +682,14 @@
      *          FileRef#getFileStore obtain} access to the file
      *          store, and in addition it checks {@link RuntimePermission}<tt>
      *          ("getFileStoreAttributes")</tt>
+     *
+     * @see FileStoreSpaceAttributeView#readAttributes()
      */
-    public static FileStoreSpaceAttributes readFileStoreSpaceAttributes(FileStore fs)
+    public static FileStoreSpaceAttributes readFileStoreSpaceAttributes(FileStore store)
         throws IOException
     {
         FileStoreSpaceAttributeView view =
-            fs.getFileStoreAttributeView(FileStoreSpaceAttributeView.class);
+            store.getFileStoreAttributeView(FileStoreSpaceAttributeView.class);
         if (view == null)
             throw new UnsupportedOperationException();
         return view.readAttributes();
--- a/src/share/classes/java/nio/file/attribute/FileOwnerAttributeView.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/FileOwnerAttributeView.java	Thu Oct 09 11:23:07 2008 +0100
@@ -59,7 +59,7 @@
     /**
      * Read the file owner.
      *
-     * <p> It it implementation specific the file owner can be a {@link
+     * <p> It it implementation specific if the file owner can be a {@link
      * UserPrincipal#isGroup() group}.
      *
      * @return  the file owner
@@ -78,7 +78,7 @@
     /**
      * Updates the file owner.
      *
-     * <p> It it implementation specific the file owner can be a {@link
+     * <p> It it implementation specific if the file owner can be a {@link
      * UserPrincipal#isGroup() group}. To ensure consistent and correct behavior
      * across platforms it is recommended that this method should only be used
      * to set the file owner to a user principal that is not a group.
--- a/src/share/classes/java/nio/file/attribute/NamedAttributeView.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/NamedAttributeView.java	Thu Oct 09 11:23:07 2008 +0100
@@ -29,23 +29,25 @@
 import java.io.IOException;
 
 /**
- * A file attribute view that provides a view of a file's <em>named
- * attributes</em>. Named attributes are typically <em>user-defined</em> and
- * used to store metadata with a file that is not meaningful to the file system.
- * It is primarily intended for file system implementations that support such a
- * mechanism directly but may be emulated by other means. For example, some
- * file systems have support for <em>extended attributes</em> or <em>named
- * streams</em>. The details of such emulation is highly implementation specific
- * and therefore not specified.
+ * A file attribute view that provides a view of a file's user-defined
+ * attributes, sometimes known as <em>extended attributes</em>. Named attributes
+ * are used to store metadata with a file that is not meaningful to the file
+ * system. It is primarily intended for file system implementations that support
+ * such a capability directly but may be emulated. The details of such emulation
+ * are highly implementation specific and therefore not specified.
  *
  * <p> This {@code FileAttributeView} provides a view of a file's named
  * attributes as a set of name/value pairs, where the attribute name is
  * represented by a {@code String}. An implementation may require to encode and
  * decode from the platform or file system representation when accessing the
- * attribute. The {@link #read read} and {@link #write write} methods are defined
- * to read into or write from a {@link ByteBuffer}. This {@code FileAttributeView}
- * is not intended to be used where the size of an attribute value is larger than
- * {@link Integer#MAX_VALUE}.
+ * attribute. The value has opaque content. This attribute view defines the
+ * {@link #read read} and {@link #write write} methods to read the value into
+ * or write from a {@link ByteBuffer}. This {@code FileAttributeView} is not
+ * intended for use where the size of an attribute value is larger than {@link
+ * Integer#MAX_VALUE}.
+ *
+ * <p> {@note There has been feedback that the read/write methods should use byte
+ * arrays instead of ByteBuffers.}
  *
  * <p> Named attributes may be used in some implementations to store security
  * related attributes so consequently, in the case of the default provider at
@@ -57,9 +59,6 @@
  * supportsFileAttributeView} method may be used to test if a specific {@link
  * java.nio.file.FileStore FileStore} supports the storage of named attributes.
  *
- * <p> {@note There has some feedback that the read/write methods should use
- * byte arrays instead of ByteBuffers.}
- *
  * @since 1.7
  */
 
--- a/src/share/classes/java/util/Formatter.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/java/util/Formatter.java	Thu Oct 09 11:23:07 2008 +0100
@@ -39,9 +39,6 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.MathContext;
-import java.nio.channels.WritableByteChannel;
-import java.nio.channels.IllegalBlockingModeException;
-import java.nio.channels.Channels;
 import java.nio.charset.Charset;
 import java.text.DateFormatSymbols;
 import java.text.DecimalFormat;
@@ -2139,96 +2136,6 @@
     }
 
     /**
-     * {@note new}
-     * Constructs a new formatter with the specified writable byte channel.
-     *
-     * <p> The output to the channel will be buffered, and as needed, the buffer
-     * will be flushed to the channel. If the channel is in non-blocking mode when
-     * bytes are to be written then an {@link IllegalBlockingModeException} will
-     * be thrown.
-     *
-     * <p> The charset used is the {@linkplain
-     * java.nio.charset.Charset#defaultCharset() default charset} for this
-     * instance of the Java virtual machine.
-     *
-     * <p> The locale used is the {@linkplain Locale#getDefault() default
-     * locale} for this instance of the Java virtual machine.
-     *
-     * @param  ch
-     *         The channel to which bytes are to be written.
-     *
-     * @since   1.7
-     */
-    public Formatter(WritableByteChannel ch) {
-        init(Channels.newWriter(ch, Charset.defaultCharset().name()),
-             Locale.getDefault());
-    }
-
-    /**
-     * {@note new}
-     * Constructs a new formatter with the specified writable byte channel and
-     * charset.
-     *
-     * <p> The output to the channel will be buffered, and as needed, the buffer
-     * will be flushed to the channel. If the channel is in non-blocking mode when
-     * bytes are to be written then an {@link IllegalBlockingModeException} will
-     * be thrown.
-     *
-     * <p> The locale used is the {@linkplain Locale#getDefault default
-     * locale} for this instance of the Java virtual machine.
-     *
-     * @param  ch
-     *         The channel to which bytes are to be written.
-     *
-     * @param  csn
-     *         The name of a supported {@linkplain java.nio.charset.Charset
-     *         charset}
-     *
-     * @throws  UnsupportedEncodingException
-     *          If the named charset is not supported
-     *
-     * @since   1.7
-     */
-    public Formatter(WritableByteChannel ch, String csn)
-        throws UnsupportedEncodingException
-    {
-        this(ch, csn, Locale.getDefault());
-    }
-
-    /**
-     * {@note new}
-     * Constructs a new formatter with the pecified writable byte channel, charset,
-     * and locale.
-     *
-     * <p> The output to the channel will be buffered, and as needed, the buffer
-     * will be flushed to the channel. If the channel is in non-blocking mode when
-     * bytes are to be written then an {@link IllegalBlockingModeException} will
-     * be thrown.
-     *
-     * @param  ch
-     *         The channel to which bytes are to be written.
-     *
-     * @param  csn
-     *         The name of a supported {@linkplain java.nio.charset.Charset
-     *         charset}
-     *
-     * @param  l
-     *         The {@linkplain java.util.Locale locale} to apply during
-     *         formatting.  If <tt>l</tt> is <tt>null</tt> then no localization
-     *         is applied.
-     *
-     * @throws  UnsupportedEncodingException
-     *          If the named charset is not supported
-     *
-     * @since   1.7
-     */
-    public Formatter(WritableByteChannel ch, String csn, Locale l)
-        throws UnsupportedEncodingException
-    {
-        init(Channels.newWriter(ch, csn), l);
-    }
-
-    /**
      * Constructs a new formatter with the specified print stream.
      *
      * <p> The locale used is the {@linkplain Locale#getDefault() default
--- a/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/classes/sun/nio/ch/SimpleAsynchronousDatagramChannelImpl.java	Thu Oct 09 11:23:07 2008 +0100
@@ -31,14 +31,14 @@
 import java.io.IOException;
 import java.util.*;
 import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.security.AccessController;
 import java.security.AccessControlContext;
 import java.security.PrivilegedExceptionAction;
 import java.security.PrivilegedActionException;
 
 /**
- * A prototype implementation of AsynchronousDatagramChannel
+ * A prototype implementation of AsynchronousDatagramChannel, used to aid
+ * test and spec development.
  */
 
 class SimpleAsynchronousDatagramChannelImpl
@@ -46,7 +46,6 @@
 {
     private final AsynchronousChannelGroupImpl group;
     private final DatagramChannel dc;
-    private final AtomicBoolean reading = new AtomicBoolean();
 
     SimpleAsynchronousDatagramChannelImpl(AsynchronousChannelGroupImpl group)
         throws IOException
@@ -56,15 +55,6 @@
         this.dc = DatagramChannel.open();
     }
 
-    private void enableReading() {
-        reading.set(false);
-    }
-
-    private void checkAndSetReading() {
-        if (!reading.compareAndSet(false, true))
-            throw new ReadPendingException();
-    }
-
     @Override
     public AsynchronousChannelGroupImpl group() {
         return group;
@@ -243,7 +233,6 @@
             null : AccessController.getContext();
         final PendingFuture<SocketAddress,A> result =
             new PendingFuture<SocketAddress,A>(this, handler, attachment);
-        checkAndSetReading();
         Runnable task = new Runnable() {
             public void run() {
                 try {
@@ -265,10 +254,10 @@
                             throw (IOException)cause;
                         }
                     }
-                    enableReading();
                     result.setResult(remote);
                 } catch (Throwable x) {
-                    enableReading();
+                    if (x instanceof ClosedChannelException)
+                        x = new AsynchronousCloseException();
                     result.setFailure(x);
                 }
                 Invoker.invokeDirect(handler, result);
@@ -309,15 +298,14 @@
 
         final PendingFuture<Integer,A> result =
             new PendingFuture<Integer,A>(this, handler, attachment);
-        checkAndSetReading();
         Runnable task = new Runnable() {
             public void run() {
                 try {
                     int n = dc.read(dst);
-                    enableReading();
                     result.setResult(n);
                 } catch (Throwable x) {
-                    enableReading();
+                    if (x instanceof ClosedChannelException)
+                        x = new AsynchronousCloseException();
                     result.setFailure(x);
                 }
                 Invoker.invokeDirect(handler, result);
--- a/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystem.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFileSystem.java	Thu Oct 09 11:23:07 2008 +0100
@@ -253,6 +253,14 @@
         }
     }
 
+    private static final Set<String> supportedFileAttributeViews =
+        Collections.unmodifiableSet(new HashSet(Arrays.asList("basic", "zip", "jar")));
+
+    @Override
+    public Set<String> supportedFileAttributeViews() {
+        return supportedFileAttributeViews;
+    }
+
     @Override
     public String toString() {
         return getZipFileSystemFile();
--- a/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java	Thu Oct 09 11:23:07 2008 +0100
@@ -100,6 +100,25 @@
         return super.newFileAttributeView(name, file, followLinks);
     }
 
+    // lazy initialization of the list of supported attribute views
+    private static class LazyInitialization {
+        static final Set<String> supportedFileAttributeViews =
+            supportedFileAttributeViews();
+        private static Set<String> supportedFileAttributeViews() {
+            Set<String> result = new HashSet<String>();
+            result.addAll(UnixFileSystem.standardFileAttributeViews());
+            // additional Linux-specific views
+            result.add("dos");
+            result.add("xattr");
+            return Collections.unmodifiableSet(result);
+        }
+    }
+
+    @Override
+    public Set<String> supportedFileAttributeViews() {
+        return LazyInitialization.supportedFileAttributeViews;
+    }
+
     @Override
     void copyNonPosixAttributes(int ofd, int nfd) {
         LinuxNamedAttributeView.copyExtendedAttributes(ofd, nfd);
--- a/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java	Thu Oct 09 11:23:07 2008 +0100
@@ -105,6 +105,25 @@
         return super.newFileAttributeView(name, file, followLinks);
     }
 
+    // lazy initialization of the list of supported attribute views
+    private static class LazyInitialization {
+        static final Set<String> supportedFileAttributeViews =
+            supportedFileAttributeViews();
+        private static Set<String> supportedFileAttributeViews() {
+            Set<String> result = new HashSet<String>();
+            result.addAll(UnixFileSystem.standardFileAttributeViews());
+            // additional Solaris-specific views
+            result.add("acl");
+            result.add("xattr");
+            return Collections.unmodifiableSet(result);
+        }
+    }
+
+    @Override
+    public Set<String> supportedFileAttributeViews() {
+        return LazyInitialization.supportedFileAttributeViews;
+    }
+
     @Override
     void copyNonPosixAttributes(int ofd, int nfd) {
         SolarisNamedAttributeView.copyExtendedAttributes(ofd, nfd);
--- a/src/solaris/classes/sun/nio/fs/UnixCopyFile.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/UnixCopyFile.java	Thu Oct 09 11:23:07 2008 +0100
@@ -26,7 +26,6 @@
 package sun.nio.fs;
 
 import java.nio.file.*;
-import java.nio.file.attribute.*;
 import java.io.IOException;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
--- a/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/UnixFileAttributeViews.java	Thu Oct 09 11:23:07 2008 +0100
@@ -32,7 +32,6 @@
 import java.io.IOException;
 
 import static sun.nio.fs.UnixNativeDispatcher.*;
-import static sun.nio.fs.UnixConstants.*;
 
 class UnixFileAttributeViews {
 
--- a/src/solaris/classes/sun/nio/fs/UnixFileModeAttribute.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/UnixFileModeAttribute.java	Thu Oct 09 11:23:07 2008 +0100
@@ -25,7 +25,6 @@
 
 package sun.nio.fs;
 
-import java.nio.file.ProviderMismatchException;
 import java.nio.file.attribute.*;
 import java.util.*;
 
--- a/src/solaris/classes/sun/nio/fs/UnixFileSystem.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/UnixFileSystem.java	Thu Oct 09 11:23:07 2008 +0100
@@ -286,6 +286,10 @@
         return (V) null;
     }
 
+    static List<String> standardFileAttributeViews() {
+        return Arrays.asList("basic", "posix", "unix", "owner");
+    }
+
     protected FileAttributeView newFileAttributeView(String name,
                                                      UnixPath file,
                                                      boolean followLinks)
--- a/src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java	Thu Oct 09 11:23:07 2008 +0100
@@ -135,8 +135,8 @@
      */
     @Override
     public SeekableByteChannel newByteChannel(Path obj,
-                                                      Set<? extends OpenOption> options,
-                                                      FileAttribute<?>... attrs)
+                                              Set<? extends OpenOption> options,
+                                              FileAttribute<?>... attrs)
         throws IOException
     {
         UnixPath file = getName(obj);
@@ -407,7 +407,6 @@
             }
         }
 
-
         @Override
         public void setTimes(Long lastModifiedTime,
                              Long lastAccessTime,
--- a/src/windows/classes/sun/nio/fs/WindowsFileSystem.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/src/windows/classes/sun/nio/fs/WindowsFileSystem.java	Thu Oct 09 11:23:07 2008 +0100
@@ -215,6 +215,15 @@
         };
     }
 
+    // supported views
+    private static final Set<String> supportedFileAttributeViews = Collections
+        .unmodifiableSet(new HashSet(Arrays.asList("basic", "dos", "acl", "owner", "xattr")));
+
+    @Override
+    public Set<String> supportedFileAttributeViews() {
+        return supportedFileAttributeViews;
+    }
+
     @Override
     public Path getPath(String path) {
         WindowsPathParser.Result result = WindowsPathParser.parse(path);
--- a/test/java/nio/channels/AsynchronousDatagramChannel/Basic.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/test/java/nio/channels/AsynchronousDatagramChannel/Basic.java	Thu Oct 09 11:23:07 2008 +0100
@@ -78,7 +78,7 @@
         sender.send(ByteBuffer.wrap(msg), sa);
         l1.await(2, TimeUnit.SECONDS);
 
-        // ReadPendingException
+        // AsynchronousCloseException
         dst.clear();
         final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
         ch.receive(dst, null, new CompletionHandler<SocketAddress,Void>() {
@@ -90,12 +90,6 @@
             public void cancelled(Void att) {
             }
         });
-        try {
-            ch.receive(ByteBuffer.allocate(100));
-            throw new RuntimeException("ReadPendingExcepiton expected");
-        } catch (ReadPendingException e) { }
-
-        // AsynchronousCloseException
         ch.close();
         Throwable result;
         while ((result = exception.get()) == null) {
@@ -156,7 +150,7 @@
         sender.send(ByteBuffer.wrap(msg), sa);
         l1.await(2, TimeUnit.SECONDS);
 
-        // ReadPendingException
+        // AsynchronousCloseException
         dst.clear();
         final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
         ch.read(dst, null, new CompletionHandler<Integer,Void>() {
@@ -168,12 +162,6 @@
             public void cancelled(Void att) {
             }
         });
-        try {
-            ch.read(ByteBuffer.allocate(100));
-            throw new RuntimeException("ReadPendingExcepiton expected");
-        } catch (ReadPendingException e) { }
-
-        // AsynchronousCloseException
         ch.close();
         Throwable result;
         while ((result = exception.get()) == null) {
--- a/test/java/nio/file/FileSystem/Basic.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/test/java/nio/file/FileSystem/Basic.java	Thu Oct 09 11:23:07 2008 +0100
@@ -41,6 +41,13 @@
             throw new RuntimeException(msg);
     }
 
+    static void checkSupported(FileSystem fs, String... views) {
+        for (String view: views) {
+            check(fs.supportedFileAttributeViews().contains(view),
+                "support for '" + view + "' expected");
+        }
+    }
+
     public static void main(String[] args) throws IOException {
         FileSystem fs = FileSystems.getDefault();
 
@@ -61,5 +68,15 @@
         for (FileStore store: fs.getFileStores()) {
             System.out.println(store);
         }
+
+        // sanity check supportedFileAttributeViews
+        checkSupported(fs, "basic");
+        String os = System.getProperty("os.name");
+        if (os.equals("SunOS"))
+            checkSupported(fs, "posix", "unix", "owner", "acl", "xattr");
+        if (os.equals("Linux"))
+            checkSupported(fs, "posix", "unix", "owner", "dos", "xattr");
+        if (os.equals("Windows"))
+            checkSupported(fs, "owner", "dos", "acl", "xattr");
     }
 }
--- a/test/java/nio/file/spi/TestProvider.java	Tue Oct 07 18:38:36 2008 +0100
+++ b/test/java/nio/file/spi/TestProvider.java	Thu Oct 09 11:23:07 2008 +0100
@@ -100,6 +100,11 @@
         }
 
         @Override
+        public Set<String> supportedFileAttributeViews() {
+            throw new RuntimeException("not implemented");
+        }
+
+        @Override
         public Path getPath(String path) {
             throw new RuntimeException("not implemented");
         }