src/solaris/classes/sun/nio/fs/UnixSecureDirectoryStream.java

Print this page

        

@@ -79,24 +79,10 @@
         if (!(obj instanceof UnixPath))
             throw new ProviderMismatchException();
         return (UnixPath)obj;
     }
 
-    private boolean followLinks(LinkOption... options) {
-        boolean followLinks = true;
-        for (LinkOption option: options) {
-            if (option == LinkOption.NOFOLLOW_LINKS) {
-                followLinks = false;
-                continue;
-            }
-            if (option == null)
-                throw new NullPointerException();
-            throw new AssertionError("Should not get here");
-        }
-        return followLinks;
-    }
-
     /**
      * Opens sub-directory in this directory
      */
     @Override
     public SecureDirectoryStream<Path> newDirectoryStream(Path obj,

@@ -103,11 +89,11 @@
                                                           LinkOption... options)
         throws IOException
     {
         UnixPath file = getName(obj);
         UnixPath child = ds.directory().resolve(file);
-        boolean followLinks = followLinks(options);
+        boolean followLinks = Util.followLinks(options);
 
         // permission check using name resolved against original path of directory
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             child.checkRead();

@@ -314,11 +300,11 @@
     public <V extends FileAttributeView> V getFileAttributeView(Path obj,
                                                                 Class<V> type,
                                                                 LinkOption... options)
     {
         UnixPath file = getName(obj);
-        boolean followLinks = followLinks(options);
+        boolean followLinks = Util.followLinks(options);
         return getFileAttributeViewImpl(file, type, followLinks);
     }
 
     /**
      * A BasicFileAttributeView implementation that using a dfd/name pair.