Security.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:elasticsearch_my 作者:
/**
 * Add access to path (and all files underneath it)
 * @param policy current policy to add permissions to
 * @param configurationName the configuration name associated with the path (for error messages only)
 * @param path the path itself
 * @param permissions set of file permissions to grant to the path
 */
static void addPath(Permissions policy, String configurationName, Path path, String permissions) {
    // paths may not exist yet, this also checks accessibility
    try {
        ensureDirectoryExists(path);
    } catch (IOException e) {
        throw new IllegalStateException("Unable to access '" + configurationName + "' (" + path + ")", e);
    }

    // add each path twice: once for itself, again for files underneath it
    policy.add(new FilePermission(path.toString(), permissions));
    policy.add(new FilePermission(path.toString() + path.getFileSystem().getSeparator() + "-", permissions));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号