changeset 712:251f70664db0

Small clean-ups in attribute package: - DOS attributes should be named "readonly", "hidden", ... - SecureDirectoryStream implementation does not support dynamic access - Typos/clarifications
author alanb
date Tue, 14 Oct 2008 10:07:09 +0100
parents 928099dfe108
children e3022f78da3b
files src/share/classes/java/nio/file/attribute/AclEntry.java src/share/classes/java/nio/file/attribute/AttributeView.java src/share/classes/java/nio/file/attribute/Attributes.java src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java src/share/classes/java/nio/file/attribute/DosFileAttributeView.java src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java src/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java test/java/nio/file/DirectoryStream/SecureDS.java test/java/nio/file/Path/Misc.java test/java/nio/file/attribute/Attributes/Basic.java
diffstat 12 files changed, 164 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/nio/file/attribute/AclEntry.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/AclEntry.java	Tue Oct 14 10:07:09 2008 +0100
@@ -39,8 +39,9 @@
  *    <li><p> The {@link #type() type} component determines if the entry
  *    grants or denies access. </p></li>
  *
- *    <li><p> The {@link #principal() who} component is a {@link UserPrincipal}
- *    corresponding to the identity that the entry grants or denies access
+ *    <li><p> The {@link #principal() principal} component, sometimes called the
+ *    "who" component, is a {@link UserPrincipal} corresponding to the identity
+ *    that the entry grants or denies access
  *    </p></li>
  *
  *    <li><p> The {@link #permissions permissions} component is a set of
@@ -143,7 +144,7 @@
         }
 
         /**
-         * Sets the "who" component of this builder.
+         * Sets the principal component of this builder.
          *
          * @return  This builder
          */
@@ -272,7 +273,7 @@
     }
 
     /**
-     * Returns the user principal representing the "who" component
+     * Returns the principal component.
      */
     public UserPrincipal principal() {
         return who;
--- a/src/share/classes/java/nio/file/attribute/AttributeView.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/AttributeView.java	Tue Oct 14 10:07:09 2008 +0100
@@ -36,9 +36,9 @@
  * type-safe methods to read or update the attributes that it supports. It also
  * provides <em>dynamic access</em> where the {@link #readAttributes
  * readAttributes}, {@link #getAttribute getAttribute} and {@link #setAttribute
- * setAttributs} methods are used to access the attributes by their attribute
- * name. Implementation should ensure that the attribute names do not contain
- * the colon (':') or comma (',') characters.
+ * setAttributs} methods are used to access the attributes by names defined
+ * by the attribute view. Implementations must ensure that the attribute names
+ * do not contain the colon (':') or comma (',') characters.
  *
  * @since 1.7
  */
--- a/src/share/classes/java/nio/file/attribute/Attributes.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/Attributes.java	Tue Oct 14 10:07:09 2008 +0100
@@ -75,8 +75,13 @@
      * 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. For example, invoking this method with the parameter
-     * {@code "posix:permissions"} attemps to set the file's permissions.
+     * within the set.
+     *
+     * <p> <b>Usage Example:</b>
+     * Suppose we want to set the DOS "hidden" attribute:
+     * <pre>
+     *    Attributes.setAttribute(file, followLinks, "dos:hidden", true);
+     * </pre>
      *
      * @param   file
      *          A file reference that locates the file
--- a/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java	Tue Oct 14 10:07:09 2008 +0100
@@ -94,10 +94,10 @@
  * </table>
  * </blockquote>
  *
- * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes
- * readAttributes(String,String[])} methods may be used to read any of these
- * attributes as if by invoking the {@link #readAttributes readAttributes()}
- * method.
+ * <p> The {@link #getAttribute getAttribute} or {@link
+ * #readAttributes(String,String[]) readAttributes(String,String[])} methods may
+ * be used to read any of these attributes as if by invoking the {@link
+ * #readAttributes() readAttributes()} method.
  *
  * <p> The {@link #setAttribute setAttribute} method may be used to update the
  * file's last modified time, last access time or create time attributes as if
@@ -143,22 +143,17 @@
      * <p> This method updates the file's timestamp attributes. The values are
      * measured since the epoch (00:00:00 GMT, January 1, 1970) and converted to
      * the precision supported by the file system. Converting from finer to
-     * coarser granularities result in precision loss. This method may not be
-     * used to update the attribute to a time that precedes the epoch.
+     * coarser granularities result in precision loss.
      *
      * <p> If any of the {@code lastModifiedTime}, {@code lastAccessTime},
      * or {@code createTime} parameters has the value {@code null} then the
-     * corresponding attribute is not changed. An implementation may require to
+     * corresponding timestamp is not changed. An implementation may require to
      * read the existing values of the file attributes when only some, but not
      * all, of the timestamp attributes are updated. Consequently, this method
      * may not be an atomic operation with respect to other file system
      * operations. If all of the {@code lastModifiedTime}, {@code
      * lastAccessTime} and {@code createTime} parameters are {@code null} then
-     * this time has no effect and the value of the {@code unit} parameter is
-     * ignored. The value of the {@code unit} parameter is also ignored if
-     * all parameters have the value {@code null}. As the timestamp attributes
-     * are optional file attributes then their values may be ignored by
-     * implementations that do not support these attributes.
+     * this method has no effect.
      *
      * @param   lastModifiedTime
      *          The new last modified time, or {@code -1L} to update it to
--- a/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java	Tue Oct 14 10:07:09 2008 +0100
@@ -47,25 +47,25 @@
  *     <th> Type </th>
  *   </tr>
  *   <tr>
- *     <td> isReadOnly </td>
+ *     <td> readonly </td>
  *     <td> {@link Boolean} </td>
  *   </tr>
  *   <tr>
- *     <td> isHidden </td>
+ *     <td> hidden </td>
  *     <td> {@link Boolean} </td>
  *   </tr>
  *   <tr>
- *     <td> isSystem </td>
+ *     <td> system </td>
  *     <td> {@link Boolean} </td>
  *   </tr>
  *   <tr>
- *     <td> isArchive </td>
+ *     <td> archive </td>
  *     <td> {@link Boolean} </td>
  *   </tr>
  * </table>
  * </blockquote>
  *
- * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes
+ * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes(String,String[])
  * readAttributes(String,String[])} methods may be used to read any of these
  * attributes, or any of the attributes defined by {@link BasicFileAttributeView}
  * as if by invoking the {@link #readAttributes readAttributes()} method.
@@ -73,10 +73,9 @@
  * <p> The {@link #setAttribute setAttribute} method may be used to update the
  * file's last modified time, last access time or create time attributes as
  * defined by {@link BasicFileAttributeView}. It may also be used to update
- * the isReadOnly, isHidden, isSystem, and isArchive attributes as if by
- * invoking the {@link #setReadOnly setReadOnly}, {@link #setHidden setHidden},
- * {@link #setSystem setSystem}, and {@link #setArchive setArchive} methods
- * respectively.
+ * the DOS attributes as if by invoking the {@link #setReadOnly setReadOnly},
+ * {@link #setHidden setHidden}, {@link #setSystem setSystem}, and {@link
+ * #setArchive setArchive} methods respectively.
  *
  * @since 1.7
  */
--- a/src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java	Tue Oct 14 10:07:09 2008 +0100
@@ -95,7 +95,7 @@
  * </table>
  * </blockquote>
  *
- * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes
+ * <p> The {@link #getAttribute getAttribute} or {@link #readAttributes(String,String[])
  * readAttributes(String,String[])} methods may be used to read any of these
  * attributes, or any of the attributes defined by {@link BasicFileAttributeView}
  * as if by invoking the {@link #readAttributes readAttributes()} method.
--- a/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/LinuxDosFileAttributeView.java	Tue Oct 14 10:07:09 2008 +0100
@@ -45,10 +45,10 @@
 {
     private static final Unsafe unsafe = Unsafe.getUnsafe();
 
-    private static final String IS_READONLY_NAME = "isReadOnly";
-    private static final String IS_ARCHIVE_NAME = "isArchive";
-    private static final String IS_SYSTEM_NAME = "isSystem";
-    private static final String IS_HIDDEN_NAME = "isHidden";
+    private static final String READONLY_NAME = "readOnly";
+    private static final String ARCHIVE_NAME = "archive";
+    private static final String SYSTEM_NAME = "system";
+    private static final String HIDDEN_NAME = "hidden";
 
     private static final String DOS_XATTR_NAME = "user.DOSATTRIB";
     private static final byte[] DOS_XATTR_NAME_AS_BYTES = DOS_XATTR_NAME.getBytes();
@@ -69,13 +69,13 @@
 
     @Override
     public Object getAttribute(String attribute) throws IOException {
-        if (attribute.equals(IS_READONLY_NAME))
+        if (attribute.equals(READONLY_NAME))
             return readAttributes().isReadOnly();
-        if (attribute.equals(IS_ARCHIVE_NAME))
+        if (attribute.equals(ARCHIVE_NAME))
             return readAttributes().isArchive();
-        if (attribute.equals(IS_SYSTEM_NAME))
+        if (attribute.equals(SYSTEM_NAME))
             return readAttributes().isSystem();
-        if (attribute.equals(IS_HIDDEN_NAME))
+        if (attribute.equals(HIDDEN_NAME))
             return readAttributes().isHidden();
         return super.getAttribute(attribute);
     }
@@ -84,19 +84,19 @@
     public void setAttribute(String attribute, Object value)
         throws IOException
     {
-        if (attribute.equals(IS_READONLY_NAME)) {
+        if (attribute.equals(READONLY_NAME)) {
             setReadOnly((Boolean)value);
             return;
         }
-        if (attribute.equals(IS_ARCHIVE_NAME)) {
+        if (attribute.equals(ARCHIVE_NAME)) {
             setArchive((Boolean)value);
             return;
         }
-        if (attribute.equals(IS_SYSTEM_NAME)) {
+        if (attribute.equals(SYSTEM_NAME)) {
             setSystem((Boolean)value);
             return;
         }
-        if (attribute.equals(IS_HIDDEN_NAME)) {
+        if (attribute.equals(HIDDEN_NAME)) {
             setHidden((Boolean)value);
             return;
         }
@@ -110,14 +110,14 @@
         AttributesBuilder builder = AttributesBuilder.create(first, rest);
         DosFileAttributes attrs = readAttributes();
         addBasicAttributesToBuilder(attrs, builder);
-        if (builder.match(IS_READONLY_NAME))
-            builder.add(IS_READONLY_NAME, attrs.isReadOnly());
-        if (builder.match(IS_ARCHIVE_NAME))
-            builder.add(IS_ARCHIVE_NAME, attrs.isArchive());
-        if (builder.match(IS_SYSTEM_NAME))
-            builder.add(IS_SYSTEM_NAME, attrs.isSystem());
-        if (builder.match(IS_HIDDEN_NAME))
-            builder.add(IS_HIDDEN_NAME, attrs.isHidden());
+        if (builder.match(READONLY_NAME))
+            builder.add(READONLY_NAME, attrs.isReadOnly());
+        if (builder.match(ARCHIVE_NAME))
+            builder.add(ARCHIVE_NAME, attrs.isArchive());
+        if (builder.match(SYSTEM_NAME))
+            builder.add(SYSTEM_NAME, attrs.isSystem());
+        if (builder.match(HIDDEN_NAME))
+            builder.add(HIDDEN_NAME, attrs.isHidden());
         return builder.unmodifiableMap();
     }
 
--- a/src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java	Tue Oct 14 10:07:09 2008 +0100
@@ -311,12 +311,10 @@
     }
 
     /**
-     * BasicForwardingFileAttributeView that works initially on the dfd/name
-     * pair. When the bind method is used to bind the view to a another file
-     * then it forwards.
+     * A BasicFileAttributeView implementation that using a dfd/name pair.
      */
     private class BasicFileAttributeViewImpl
-        implements BasicFileAttributeView
+        extends AbstractBasicFileAttributeView
     {
         final UnixPath file;
         final boolean followLinks;
@@ -355,28 +353,6 @@
         }
 
         @Override
-        public Object getAttribute(String attribute) throws IOException {
-            // FIXME
-            return null;
-        }
-
-        @Override
-        public void setAttribute(String attribute, Object value)
-            throws IOException
-        {
-            // FIXME
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Map<String,?> readAttributes(String first, String[] rest)
-            throws IOException
-        {
-            // FIXME
-            return Collections.emptyMap();
-        }
-
-        @Override
         public BasicFileAttributes readAttributes() throws IOException {
             ds.readLock().lock();
             try {
@@ -483,13 +459,15 @@
     }
 
     /**
-     * PosixFileAttributeView that works initially on the dfd/name pair. When
-     * the bind method is used to bind the view to a another file then it
-     * forwards.
+     * A PosixFileAttributeView implementation that using a dfd/name pair.
      */
     private class PosixFileAttributeViewImpl
         extends BasicFileAttributeViewImpl implements PosixFileAttributeView
     {
+        private static final String PERMISSIONS_NAME = "permissions";
+        private static final String OWNER_NAME = "owner";
+        private static final String GROUP_NAME = "group";
+
         PosixFileAttributeViewImpl(UnixPath file, boolean followLinks) {
             super(file, followLinks);
         }
@@ -508,10 +486,56 @@
         }
 
         @Override
+        public Object getAttribute(String attribute) throws IOException {
+            if (attribute.equals(PERMISSIONS_NAME))
+                return readAttributes().permissions();
+            if (attribute.equals(OWNER_NAME))
+                return readAttributes().owner();
+            if (attribute.equals(GROUP_NAME))
+                return readAttributes().group();
+            return super.getAttribute(attribute);
+        }
+
+        @Override
+        @SuppressWarnings("unchecked")
         public void setAttribute(String attribute, Object value)
             throws IOException
         {
-            throw new UnsupportedOperationException();
+            if (attribute.equals(PERMISSIONS_NAME)) {
+                setPermissions((Set<PosixFilePermission>)value);
+                return;
+            }
+            if (attribute.equals(OWNER_NAME)) {
+                setOwner((UserPrincipal)value);
+                return;
+            }
+            if (attribute.equals(GROUP_NAME)) {
+                setGroup((UserPrincipal)value);
+                return;
+            }
+            super.setAttribute(attribute, value);
+        }
+
+        final void addPosixAttributesToBuilder(PosixFileAttributes attrs,
+                                               AttributesBuilder builder)
+        {
+            if (builder.match(PERMISSIONS_NAME))
+                builder.add(PERMISSIONS_NAME, attrs.permissions());
+            if (builder.match(OWNER_NAME))
+                builder.add(OWNER_NAME, attrs.owner());
+            if (builder.match(GROUP_NAME))
+                builder.add(GROUP_NAME, attrs.group());
+        }
+
+        @Override
+        public Map<String,?> readAttributes(String first, String[] rest)
+            throws IOException
+        {
+            AttributesBuilder builder = AttributesBuilder.create(first, rest);
+            PosixFileAttributes attrs = readAttributes();
+            addBasicAttributesToBuilder(attrs, builder);
+            addPosixAttributesToBuilder(attrs, builder);
+            return builder.unmodifiableMap();
         }
 
         @Override
--- a/src/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/src/windows/classes/sun/nio/fs/WindowsFileAttributeViews.java	Tue Oct 14 10:07:09 2008 +0100
@@ -142,10 +142,10 @@
     }
 
     static class Dos extends Basic implements DosFileAttributeView {
-        private static final String IS_READONLY_NAME = "isReadOnly";
-        private static final String IS_ARCHIVE_NAME = "isArchive";
-        private static final String IS_SYSTEM_NAME = "isSystem";
-        private static final String IS_HIDDEN_NAME = "isHidden";
+        private static final String READONLY_NAME = "readonly";
+        private static final String ARCHIVE_NAME = "archive";
+        private static final String SYSTEM_NAME = "system";
+        private static final String HIDDEN_NAME = "hidden";
         private static final String ATTRIBUTES_NAME = "attributes";
 
         Dos(WindowsPath file, boolean followLinks) {
@@ -159,13 +159,13 @@
 
         @Override
         public Object getAttribute(String attribute) throws IOException {
-            if (attribute.equals(IS_READONLY_NAME))
+            if (attribute.equals(READONLY_NAME))
                 return readAttributes().isReadOnly();
-            if (attribute.equals(IS_ARCHIVE_NAME))
+            if (attribute.equals(ARCHIVE_NAME))
                 return readAttributes().isArchive();
-            if (attribute.equals(IS_SYSTEM_NAME))
+            if (attribute.equals(SYSTEM_NAME))
                 return readAttributes().isSystem();
-            if (attribute.equals(IS_HIDDEN_NAME))
+            if (attribute.equals(HIDDEN_NAME))
                 return readAttributes().isHidden();
             // implementation specific
             if (attribute.equals(ATTRIBUTES_NAME))
@@ -177,19 +177,19 @@
         public void setAttribute(String attribute, Object value)
             throws IOException
         {
-            if (attribute.equals(IS_READONLY_NAME)) {
+            if (attribute.equals(READONLY_NAME)) {
                 setReadOnly((Boolean)value);
                 return;
             }
-            if (attribute.equals(IS_ARCHIVE_NAME)) {
+            if (attribute.equals(ARCHIVE_NAME)) {
                 setArchive((Boolean)value);
                 return;
             }
-            if (attribute.equals(IS_SYSTEM_NAME)) {
+            if (attribute.equals(SYSTEM_NAME)) {
                 setSystem((Boolean)value);
                 return;
             }
-            if (attribute.equals(IS_HIDDEN_NAME)) {
+            if (attribute.equals(HIDDEN_NAME)) {
                 setHidden((Boolean)value);
                 return;
             }
@@ -203,14 +203,14 @@
             AttributesBuilder builder = AttributesBuilder.create(first, rest);
             WindowsFileAttributes attrs = readAttributes();
             addBasicAttributesToBuilder(attrs, builder);
-            if (builder.match(IS_READONLY_NAME))
-                builder.add(IS_READONLY_NAME, attrs.isReadOnly());
-            if (builder.match(IS_ARCHIVE_NAME))
-                builder.add(IS_ARCHIVE_NAME, attrs.isArchive());
-            if (builder.match(IS_SYSTEM_NAME))
-                builder.add(IS_SYSTEM_NAME, attrs.isSystem());
-            if (builder.match(IS_HIDDEN_NAME))
-                builder.add(IS_HIDDEN_NAME, attrs.isHidden());
+            if (builder.match(READONLY_NAME))
+                builder.add(READONLY_NAME, attrs.isReadOnly());
+            if (builder.match(ARCHIVE_NAME))
+                builder.add(ARCHIVE_NAME, attrs.isArchive());
+            if (builder.match(SYSTEM_NAME))
+                builder.add(SYSTEM_NAME, attrs.isSystem());
+            if (builder.match(HIDDEN_NAME))
+                builder.add(HIDDEN_NAME, attrs.isHidden());
             if (builder.match(ATTRIBUTES_NAME))
                 builder.add(ATTRIBUTES_NAME, attrs.attributes());
             return builder.unmodifiableMap();
--- a/test/java/nio/file/DirectoryStream/SecureDS.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/test/java/nio/file/DirectoryStream/SecureDS.java	Tue Oct 14 10:07:09 2008 +0100
@@ -95,6 +95,18 @@
                 .readAttributes()
                     .isDirectory());
 
+        // Test: dynamic access to directory's attributes
+        BasicFileAttributeView view = stream.
+            getFileAttributeView(BasicFileAttributeView.class);
+        Map<String,?> attrs = view.readAttributes("*");
+        assertTrue((Boolean)attrs.get("isDirectory"));
+        attrs = view.readAttributes("isRegularFile", "size");
+        assertTrue(!(Boolean)attrs.get("isRegularFile"));
+        assertTrue((Long)attrs.get("size") >= 0);
+        int linkCount = (Integer)view.getAttribute("linkCount");
+        assertTrue(linkCount > 0);
+        view.setAttribute("lastModifiedTime", 0L);
+
         // Test: getFileAttributeView to access attributes of entries
         assertTrue(stream
             .getFileAttributeView(fileEntry, BasicFileAttributeView.class, true)
@@ -131,6 +143,17 @@
                         .isSymbolicLink());
         }
 
+        // Test: dynamic access to entry attributes
+        view = stream
+             .getFileAttributeView(fileEntry, PosixFileAttributeView.class, false);
+        if (view != null) {
+            attrs = view.readAttributes("owner", "size");
+            UserPrincipal owner = (UserPrincipal)attrs.get("owner");
+            assertTrue(owner != null);
+            assertTrue((Long)attrs.get("size") >= 0L);
+            view.setAttribute("lastAccessTime", 0L);
+        }
+
         // Test: newByteChannel
         Set<StandardOpenOption> opts = Collections.emptySet();
         stream.newByteChannel(fileEntry, opts).close();
--- a/test/java/nio/file/Path/Misc.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/test/java/nio/file/Path/Misc.java	Tue Oct 14 10:07:09 2008 +0100
@@ -331,7 +331,7 @@
         if (isWindows) {
             file.createFile();
             try {
-                Attributes.setAttribute(file, "dos:isHidden", true);
+                Attributes.setAttribute(file, "dos:hidden", true);
                 assertTrue(file.isHidden());
             } finally {
                 file.delete();
--- a/test/java/nio/file/attribute/Attributes/Basic.java	Tue Oct 14 09:59:39 2008 +0100
+++ b/test/java/nio/file/attribute/Attributes/Basic.java	Tue Oct 14 10:07:09 2008 +0100
@@ -173,51 +173,51 @@
 
         // getAttribute
         checkEqual(attrs.isReadOnly(),
-                   Attributes.getAttribute(file, true, "dos:isReadOnly"));
+                   Attributes.getAttribute(file, true, "dos:readonly"));
         checkEqual(attrs.isHidden(),
-                   Attributes.getAttribute(file, true, "dos:isHidden"));
+                   Attributes.getAttribute(file, true, "dos:hidden"));
         checkEqual(attrs.isSystem(),
-                   Attributes.getAttribute(file, true, "dos:isSystem"));
+                   Attributes.getAttribute(file, true, "dos:system"));
         checkEqual(attrs.isArchive(),
-                   Attributes.getAttribute(file, true, "dos:isArchive"));
+                   Attributes.getAttribute(file, true, "dos:archive"));
 
         // setAttribute
         boolean value;
 
         value = attrs.isReadOnly();
-        Attributes.setAttribute(file, "dos:isReadOnly", !value);
+        Attributes.setAttribute(file, "dos:readonly", !value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isReadOnly(), !value);
-        Attributes.setAttribute(file, "dos:isReadOnly", value);
+        Attributes.setAttribute(file, "dos:readonly", value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isReadOnly(), value);
 
         value = attrs.isHidden();
-        Attributes.setAttribute(file, "dos:isHidden", !value);
+        Attributes.setAttribute(file, "dos:hidden", !value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isHidden(), !value);
-        Attributes.setAttribute(file, "dos:isHidden", value);
+        Attributes.setAttribute(file, "dos:hidden", value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isHidden(), value);
 
         value = attrs.isSystem();
-        Attributes.setAttribute(file, "dos:isSystem", !value);
+        Attributes.setAttribute(file, "dos:system", !value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isSystem(), !value);
-        Attributes.setAttribute(file, "dos:isSystem", value);
+        Attributes.setAttribute(file, "dos:system", value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isSystem(), value);
 
         value = attrs.isArchive();
-        Attributes.setAttribute(file, "dos:isArchive", !value);
+        Attributes.setAttribute(file, "dos:archive", !value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isArchive(), !value);
-        Attributes.setAttribute(file, "dos:isArchive", value);
+        Attributes.setAttribute(file, "dos:archive", value);
         checkEqual(Attributes.readDosFileAttributes(file, true).isArchive(), value);
 
         // readAttributes
         Map<String,?> map;
         map = Attributes.readAttributes(file, true, "dos:*");
         assertTrue(map.size() >= 15);
-        checkEqual(attrs.isReadOnly(), map.get("isReadOnly")); // check one
+        checkEqual(attrs.isReadOnly(), map.get("readonly")); // check one
 
-        map = Attributes.readAttributes(file, true, "dos:size,isHidden,ShouldNotExist");
+        map = Attributes.readAttributes(file, true, "dos:size,hidden,ShouldNotExist");
         assertTrue(map.size() == 2);
         checkEqual(attrs.size(), map.get("size"));
-        checkEqual(attrs.isHidden(), map.get("isHidden"));
+        checkEqual(attrs.isHidden(), map.get("hidden"));
     }
 
     static void doTests(Path dir) throws IOException {