Java Code Examples for sun.security.util.SecurityConstants#FILE_READLINK_ACTION

The following examples show how to use sun.security.util.SecurityConstants#FILE_READLINK_ACTION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnixFileSystemProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 2
Source File: UnixFileSystemProvider.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 3
Source File: WindowsFileSystemProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 4
Source File: UnixFileSystemProvider.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 5
Source File: WindowsFileSystemProvider.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 6
Source File: UnixFileSystemProvider.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 7
Source File: WindowsFileSystemProvider.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 8
Source File: UnixFileSystemProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 9
Source File: UnixFileSystemProvider.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 10
Source File: WindowsFileSystemProvider.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 11
Source File: WindowsFileSystemProvider.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 12
Source File: UnixFileSystemProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 13
Source File: WindowsFileSystemProvider.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 14
Source File: UnixFileSystemProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 15
Source File: WindowsFileSystemProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 16
Source File: UnixFileSystemProvider.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}
 
Example 17
Source File: WindowsFileSystemProvider.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 18
Source File: WindowsFileSystemProvider.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 19
Source File: WindowsFileSystemProvider.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    WindowsPath link = WindowsPath.toWindowsPath(obj1);
    WindowsFileSystem fs = link.getFileSystem();
    if (!fs.supportsLinks()) {
        throw new UnsupportedOperationException("symbolic links not supported");
    }

    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }

    String target = WindowsLinkSupport.readLink(link);
    return WindowsPath.createFromNormalizedPath(fs, target);
}
 
Example 20
Source File: UnixFileSystemProvider.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Path readSymbolicLink(Path obj1) throws IOException {
    UnixPath link = UnixPath.toUnixPath(obj1);
    // permission check
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission perm = new FilePermission(link.getPathForPermissionCheck(),
            SecurityConstants.FILE_READLINK_ACTION);
        sm.checkPermission(perm);
    }
    try {
        byte[] target = readlink(link);
        return new UnixPath(link.getFileSystem(), target);
    } catch (UnixException x) {
       if (x.errno() == UnixConstants.EINVAL)
            throw new NotLinkException(link.getPathForExceptionMessage());
        x.rethrowAsIOException(link);
        return null;    // keep compiler happy
    }
}