changeset 4909:ebeb9c8e0bb8

7133476: (fs) Files.readAttributes throws NPE on MacOSX Reviewed-by: michaelm
author alanb
date Mon, 30 Jan 2012 13:52:32 +0000
parents 926b1d1014cf
children cb029d9b830a
files src/solaris/classes/sun/nio/fs/BsdFileStore.java src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java
diffstat 2 files changed, 0 insertions(+), 105 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/sun/nio/fs/BsdFileStore.java	Mon Jan 30 13:49:56 2012 +0000
+++ b/src/solaris/classes/sun/nio/fs/BsdFileStore.java	Mon Jan 30 13:52:32 2012 +0000
@@ -85,76 +85,4 @@
 
         throw new IOException("Mount point not found in fstab");
     }
-
-    // returns true if extended attributes enabled on file system where given
-    // file resides, returns false if disabled or unable to determine.
-    private boolean isExtendedAttributesEnabled(UnixPath path) {
-/*
-        try {
-            int fd = path.openForAttributeAccess(false);
-            try {
-                // fgetxattr returns size if called with size==0
-                BsdNativeDispatcher.fgetxattr(fd, "user.java".getBytes(), 0L, 0);
-                return true;
-            } catch (UnixException e) {
-                // attribute does not exist
-                if (e.errno() == UnixConstants.ENODATA)
-                    return true;
-            } finally {
-                UnixNativeDispatcher.close(fd);
-            }
-        } catch (IOException ignore) {
-            // nothing we can do
-        }
-*/
-        return false;
-    }
-
-    @Override
-    public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
-/*
-        // support DosFileAttributeView and UserDefinedAttributeView if extended
-        // attributes enabled
-        if (type == DosFileAttributeView.class ||
-            type == UserDefinedFileAttributeView.class)
-        {
-            // lookup fstypes.properties
-            FeatureStatus status = checkIfFeaturePresent("user_xattr");
-            if (status == FeatureStatus.PRESENT)
-                return true;
-            if (status == FeatureStatus.NOT_PRESENT)
-                return false;
-
-            // if file system is mounted with user_xattr option then assume
-            // extended attributes are enabled
-            if ((entry().hasOption("user_xattr")))
-                return true;
-
-            // user_xattr option not present but we special-case ext3/4 as we
-            // know that extended attributes are not enabled by default.
-            if (entry().fstype().equals("ext3") || entry().fstype().equals("ext4"))
-                return false;
-
-            // not ext3/4 so probe mount point
-            if (!xattrChecked) {
-                UnixPath dir = new UnixPath(file().getFileSystem(), entry().dir());
-                xattrEnabled = isExtendedAttributesEnabled(dir);
-                xattrChecked = true;
-            }
-            return xattrEnabled;
-        }
-*/
-        return super.supportsFileAttributeView(type);
-    }
-
-    @Override
-    public boolean supportsFileAttributeView(String name) {
-/*
-        if (name.equals("dos"))
-            return supportsFileAttributeView(DosFileAttributeView.class);
-        if (name.equals("user"))
-            return supportsFileAttributeView(UserDefinedFileAttributeView.class);
-*/
-        return super.supportsFileAttributeView(name);
-    }
 }
--- a/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java	Mon Jan 30 13:49:56 2012 +0000
+++ b/src/solaris/classes/sun/nio/fs/BsdFileSystemProvider.java	Mon Jan 30 13:52:32 2012 +0000
@@ -47,37 +47,4 @@
     BsdFileStore getFileStore(UnixPath path) throws IOException {
         return new BsdFileStore(path);
     }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public <V extends FileAttributeView> V getFileAttributeView(Path obj,
-                                                                Class<V> type,
-                                                                LinkOption... options)
-    {
-        return super.getFileAttributeView(obj, type, options);
-    }
-
-    @Override
-    public DynamicFileAttributeView getFileAttributeView(Path obj,
-                                                         String name,
-                                                         LinkOption... options)
-    {
-        return super.getFileAttributeView(obj, name, options);
-    }
-
-    @Override
-    @SuppressWarnings("unchecked")
-    public <A extends BasicFileAttributes> A readAttributes(Path file,
-                                                            Class<A> type,
-                                                            LinkOption... options)
-        throws IOException
-    {
-        if (type == DosFileAttributes.class) {
-            DosFileAttributeView view =
-                getFileAttributeView(file, DosFileAttributeView.class, options);
-            return (A) view.readAttributes();
-        } else {
-            return super.readAttributes(file, type, options);
-        }
-    }
 }