src/windows/classes/sun/nio/fs/WindowsPath.java

Print this page




 814 
 815     @Override
 816     public WindowsPath toAbsolutePath() {
 817         if (isAbsolute())
 818             return this;
 819 
 820         // permission check as per spec
 821         SecurityManager sm = System.getSecurityManager();
 822         if (sm != null) {
 823             sm.checkPropertyAccess("user.dir");
 824         }
 825 
 826         try {
 827             return createFromNormalizedPath(getFileSystem(), getAbsolutePath());
 828         } catch (WindowsException x) {
 829             throw new IOError(new IOException(x.getMessage()));
 830         }
 831     }
 832 
 833     @Override
 834     public WindowsPath toRealPath(boolean resolveLinks) throws IOException {
 835         checkRead();
 836         String rp = WindowsLinkSupport.getRealPath(this, resolveLinks);
 837         return createFromNormalizedPath(getFileSystem(), rp);
 838     }
 839 
 840     @Override
 841     public WatchKey register(WatchService watcher,
 842                              WatchEvent.Kind<?>[] events,
 843                              WatchEvent.Modifier... modifiers)
 844         throws IOException
 845     {
 846         if (watcher == null)
 847             throw new NullPointerException();
 848         if (!(watcher instanceof WindowsWatchService))
 849             throw new ProviderMismatchException();
 850 
 851         // When a security manager is set then we need to make a defensive
 852         // copy of the modifiers and check for the Windows specific FILE_TREE
 853         // modifier. When the modifier is present then check that permission
 854         // has been granted recursively.
 855         SecurityManager sm = System.getSecurityManager();
 856         if (sm != null) {




 814 
 815     @Override
 816     public WindowsPath toAbsolutePath() {
 817         if (isAbsolute())
 818             return this;
 819 
 820         // permission check as per spec
 821         SecurityManager sm = System.getSecurityManager();
 822         if (sm != null) {
 823             sm.checkPropertyAccess("user.dir");
 824         }
 825 
 826         try {
 827             return createFromNormalizedPath(getFileSystem(), getAbsolutePath());
 828         } catch (WindowsException x) {
 829             throw new IOError(new IOException(x.getMessage()));
 830         }
 831     }
 832 
 833     @Override
 834     public WindowsPath toRealPath(LinkOption... options) throws IOException {
 835         checkRead();
 836         String rp = WindowsLinkSupport.getRealPath(this, Util.followLinks(options));
 837         return createFromNormalizedPath(getFileSystem(), rp);
 838     }
 839 
 840     @Override
 841     public WatchKey register(WatchService watcher,
 842                              WatchEvent.Kind<?>[] events,
 843                              WatchEvent.Modifier... modifiers)
 844         throws IOException
 845     {
 846         if (watcher == null)
 847             throw new NullPointerException();
 848         if (!(watcher instanceof WindowsWatchService))
 849             throw new ProviderMismatchException();
 850 
 851         // When a security manager is set then we need to make a defensive
 852         // copy of the modifiers and check for the Windows specific FILE_TREE
 853         // modifier. When the modifier is present then check that permission
 854         // has been granted recursively.
 855         SecurityManager sm = System.getSecurityManager();
 856         if (sm != null) {