• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PathUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.elasticsearch.common.io.PathUtils的典型用法代码示例。如果您正苦于以下问题:Java PathUtils类的具体用法?Java PathUtils怎么用?Java PathUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PathUtils类属于org.elasticsearch.common.io包,在下文中一共展示了PathUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testMissingWritePermissionOnShard

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testMissingWritePermissionOnShard() throws IOException {
    assumeTrue("posix filesystem", isPosix);
    final String[] tempPaths = tmpPaths();
    Path path = PathUtils.get(randomFrom(tempPaths));
    Path fooIndex = path.resolve("nodes").resolve("0").resolve(NodeEnvironment.INDICES_FOLDER)
        .resolve("foo");
    Path fooShard = fooIndex.resolve("0");
    Path fooShardIndex = fooShard.resolve("index");
    Path fooShardTranslog = fooShard.resolve("translog");
    Path fooShardState = fooShard.resolve("_state");
    Path pick = randomFrom(fooShard, fooShardIndex, fooShardTranslog, fooShardState);
    Files.createDirectories(pick);
    try (PosixPermissionsResetter attr = new PosixPermissionsResetter(pick)) {
        attr.setPermissions(new HashSet<>(Arrays.asList(PosixFilePermission.OTHERS_READ, PosixFilePermission.GROUP_READ,
            PosixFilePermission.OWNER_READ)));
        Settings build = Settings.builder()
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toAbsolutePath().toString())
            .putArray(Environment.PATH_DATA_SETTING.getKey(), tempPaths).build();
        IOException ioException = expectThrows(IOException.class, () -> {
            new NodeEnvironment(build, new Environment(build));
        });
        assertTrue(ioException.getMessage(), ioException.getMessage().startsWith("failed to write in data directory"));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:NodeEnvironmentEvilTests.java


示例2: testSetMaximumNumberOfThreads

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testSetMaximumNumberOfThreads() throws IOException {
    if (Constants.LINUX) {
        final List<String> lines = Files.readAllLines(PathUtils.get("/proc/self/limits"));
        if (!lines.isEmpty()) {
            for (String line : lines) {
                if (line != null && line.startsWith("Max processes")) {
                    final String[] fields = line.split("\\s+");
                    final long limit = "unlimited".equals(fields[2]) ? JNACLibrary.RLIM_INFINITY : Long.parseLong(fields[2]);
                    assertThat(JNANatives.MAX_NUMBER_OF_THREADS, equalTo(limit));
                    return;
                }
            }
        }
        fail("should have read max processes from /proc/self/limits");
    } else {
        assertThat(JNANatives.MAX_NUMBER_OF_THREADS, equalTo(-1L));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:EvilJNANativesTests.java


示例3: testMissingWritePermission

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testMissingWritePermission() throws IOException {
    assumeTrue("posix filesystem", isPosix);
    final String[] tempPaths = tmpPaths();
    Path path = PathUtils.get(randomFrom(tempPaths));
    try (PosixPermissionsResetter attr = new PosixPermissionsResetter(path)) {
        attr.setPermissions(new HashSet<>(Arrays.asList(PosixFilePermission.OTHERS_READ, PosixFilePermission.GROUP_READ,
            PosixFilePermission.OWNER_READ)));
        Settings build = Settings.builder()
                .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toAbsolutePath().toString())
                .putArray(Environment.PATH_DATA_SETTING.getKey(), tempPaths).build();
        IOException ioException = expectThrows(IOException.class, () -> {
            new NodeEnvironment(build, new Environment(build));
        });
        assertTrue(ioException.getMessage(), ioException.getMessage().startsWith(path.toString()));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:NodeEnvironmentEvilTests.java


示例4: testMissingWritePermissionOnIndex

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testMissingWritePermissionOnIndex() throws IOException {
    assumeTrue("posix filesystem", isPosix);
    final String[] tempPaths = tmpPaths();
    Path path = PathUtils.get(randomFrom(tempPaths));
    Path fooIndex = path.resolve("nodes").resolve("0").resolve(NodeEnvironment.INDICES_FOLDER)
        .resolve("foo");
    Files.createDirectories(fooIndex);
    try (PosixPermissionsResetter attr = new PosixPermissionsResetter(fooIndex)) {
        attr.setPermissions(new HashSet<>(Arrays.asList(PosixFilePermission.OTHERS_READ, PosixFilePermission.GROUP_READ,
            PosixFilePermission.OWNER_READ)));
        Settings build = Settings.builder()
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toAbsolutePath().toString())
            .putArray(Environment.PATH_DATA_SETTING.getKey(), tempPaths).build();
        IOException ioException = expectThrows(IOException.class, () -> {
            new NodeEnvironment(build, new Environment(build));
        });
        assertTrue(ioException.getMessage(), ioException.getMessage().startsWith("failed to write in data directory"));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:NodeEnvironmentEvilTests.java


示例5: testLocationInfoTest

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testLocationInfoTest() throws IOException, UserException {
    setupLogging("location_info");

    final Logger testLogger = ESLoggerFactory.getLogger("test");

    testLogger.error("This is an error message");
    testLogger.warn("This is a warning message");
    testLogger.info("This is an info message");
    testLogger.debug("This is a debug message");
    testLogger.trace("This is a trace message");
    final String path =
        System.getProperty("es.logs.base_path") +
            System.getProperty("file.separator") +
            System.getProperty("es.logs.cluster_name") +
            ".log";
    final List<String> events = Files.readAllLines(PathUtils.get(path));
    assertThat(events.size(), equalTo(5));
    final String location = "org.elasticsearch.common.logging.EvilLoggerTests.testLocationInfoTest";
    // the first message is a warning for unsupported configuration files
    assertLogLine(events.get(0), Level.ERROR, location, "This is an error message");
    assertLogLine(events.get(1), Level.WARN, location, "This is a warning message");
    assertLogLine(events.get(2), Level.INFO, location, "This is an info message");
    assertLogLine(events.get(3), Level.DEBUG, location, "This is a debug message");
    assertLogLine(events.get(4), Level.TRACE, location, "This is a trace message");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:EvilLoggerTests.java


示例6: testDeprecationLogger

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testDeprecationLogger() throws IOException, UserException {
    setupLogging("deprecation");

    final DeprecationLogger deprecationLogger = new DeprecationLogger(ESLoggerFactory.getLogger("deprecation"));

    deprecationLogger.deprecated("This is a deprecation message");
    final String deprecationPath =
        System.getProperty("es.logs.base_path") +
            System.getProperty("file.separator") +
            System.getProperty("es.logs.cluster_name") +
            "_deprecation.log";
    final List<String> deprecationEvents = Files.readAllLines(PathUtils.get(deprecationPath));
    assertThat(deprecationEvents.size(), equalTo(1));
    assertLogLine(
        deprecationEvents.get(0),
        Level.WARN,
        "org.elasticsearch.common.logging.DeprecationLogger.deprecated",
        "This is a deprecation message");
    assertWarnings("This is a deprecation message");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:EvilLoggerTests.java


示例7: testSetMaxSizeVirtualMemory

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testSetMaxSizeVirtualMemory() throws IOException {
    if (Constants.LINUX) {
        final List<String> lines = Files.readAllLines(PathUtils.get("/proc/self/limits"));
        if (!lines.isEmpty()) {
            for (String line : lines) {
                if (line != null && line.startsWith("Max address space")) {
                    final String[] fields = line.split("\\s+");
                    final String limit = fields[3];
                    assertEquals(JNANatives.rlimitToString(JNANatives.MAX_SIZE_VIRTUAL_MEMORY), limit);
                    return;
                }
            }
        }
        fail("should have read max size virtual memory from /proc/self/limits");
    } else if (Constants.MAC_OS_X) {
        assertThat(JNANatives.MAX_SIZE_VIRTUAL_MEMORY, anyOf(equalTo(Long.MIN_VALUE), greaterThanOrEqualTo(0L)));
    } else {
        assertThat(JNANatives.MAX_SIZE_VIRTUAL_MEMORY, equalTo(Long.MIN_VALUE));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:EvilJNANativesTests.java


示例8: getTempDir

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
@SuppressForbidden(reason = "access temp directory for building index")
protected static synchronized FSDirectory getTempDir() {
    if (tmpBuildDir == null) {
        // Lazy init
        String tempDirPath = System.getProperty("java.io.tmpdir");
        if (tempDirPath == null)  {
            throw new RuntimeException("Java has no temporary folder property (java.io.tmpdir)?");
        }
        try {
            tmpBuildDir = FSDirectory.open(PathUtils.get(tempDirPath));
        } catch (IOException ioe) {
            throw new RuntimeException(ioe);
        }
    }
    return tmpBuildDir;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:XAnalyzingSuggester.java


示例9: testNodeLockSingleEnvironment

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testNodeLockSingleEnvironment() throws IOException {
    final Settings settings = buildEnvSettings(Settings.builder().put("node.max_local_storage_nodes", 1).build());
    NodeEnvironment env = newNodeEnvironment(settings);
    List<String> dataPaths = Environment.PATH_DATA_SETTING.get(settings);

    // Reuse the same location and attempt to lock again
    IllegalStateException ex =
        expectThrows(IllegalStateException.class, () -> new NodeEnvironment(settings, new Environment(settings)));
    assertThat(ex.getMessage(), containsString("failed to obtain node lock"));

    // Close the environment that holds the lock and make sure we can get the lock after release
    env.close();
    env = new NodeEnvironment(settings, new Environment(settings));
    assertThat(env.nodeDataPaths(), arrayWithSize(dataPaths.size()));

    for (int i = 0; i < dataPaths.size(); i++) {
        assertTrue(env.nodeDataPaths()[i].startsWith(PathUtils.get(dataPaths.get(i))));
    }
    env.close();
    assertThat(env.lockedShards(), empty());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:NodeEnvironmentTests.java


示例10: getTranslogDirs

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
private Set<Path> getTranslogDirs(String indexName) throws IOException {
    ClusterState state = client().admin().cluster().prepareState().get().getState();
    GroupShardsIterator shardIterators = state.getRoutingTable().activePrimaryShardsGrouped(new String[]{indexName}, false);
    final Index idx = state.metaData().index(indexName).getIndex();
    List<ShardIterator> iterators = iterableAsArrayList(shardIterators);
    ShardIterator shardIterator = RandomPicks.randomFrom(random(), iterators);
    ShardRouting shardRouting = shardIterator.nextOrNull();
    assertNotNull(shardRouting);
    assertTrue(shardRouting.primary());
    assertTrue(shardRouting.assignedToNode());
    String nodeId = shardRouting.currentNodeId();
    NodesStatsResponse nodeStatses = client().admin().cluster().prepareNodesStats(nodeId).setFs(true).get();
    Set<Path> translogDirs = new TreeSet<>(); // treeset makes sure iteration order is deterministic
    for (FsInfo.Path fsPath : nodeStatses.getNodes().get(0).getFs()) {
        String path = fsPath.getPath();
        final String relativeDataLocationPath =  "indices/"+ idx.getUUID() +"/" + Integer.toString(shardRouting.getId()) + "/translog";
        Path translogPath = PathUtils.get(path).resolve(relativeDataLocationPath);
        if (Files.isDirectory(translogPath)) {
            translogDirs.add(translogPath);
        }
    }
    return translogDirs;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:TruncateTranslogIT.java


示例11: listShardFiles

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public List<Path> listShardFiles(ShardRouting routing) throws IOException {
    NodesStatsResponse nodeStatses = client().admin().cluster().prepareNodesStats(routing.currentNodeId()).setFs(true).get();
    ClusterState state = client().admin().cluster().prepareState().get().getState();
    final Index test = state.metaData().index("test").getIndex();
    assertThat(routing.toString(), nodeStatses.getNodes().size(), equalTo(1));
    List<Path> files = new ArrayList<>();
    for (FsInfo.Path info : nodeStatses.getNodes().get(0).getFs()) {
        String path = info.getPath();
        Path file = PathUtils.get(path).resolve("indices/" + test.getUUID() + "/" + Integer.toString(routing.getId()) + "/index");
        if (Files.exists(file)) { // multi data path might only have one path in use
            try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) {
                for (Path item : stream) {
                    files.add(item);
                }
            }
        }
    }
    return files;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:CorruptedFileIT.java


示例12: testMap

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testMap() throws Exception {
    Map<String, Map<String, ?>> maps = new HashMap<>();
    maps.put("{'map':null}", (Map) null);
    maps.put("{'map':{}}", Collections.emptyMap());
    maps.put("{'map':{'key':'value'}}", singletonMap("key", "value"));

    Map<String, Object> innerMap = new HashMap<>();
    innerMap.put("string", "value");
    innerMap.put("int", 42);
    innerMap.put("long", 42L);
    innerMap.put("long[]", new long[]{1L, 3L});
    innerMap.put("path", PathUtils.get("path", "to", "file"));
    innerMap.put("object", singletonMap("key", "value"));

    final String path = Constants.WINDOWS ? "path\\\\to\\\\file" : "path/to/file";
    maps.put("{'map':{'path':'" + path + "','string':'value','long[]':[1,3],'int':42,'long':42,'object':{'key':'value'}}}", innerMap);

    for (Map.Entry<String, Map<String, ?>> m : maps.entrySet()) {
        final String expected = m.getKey();
        assertResult(expected, () -> builder().startObject().field("map", m.getValue()).endObject());
        assertResult(expected, () -> builder().startObject().field("map").value(m.getValue()).endObject());
        assertResult(expected, () -> builder().startObject().field("map").map(m.getValue()).endObject());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:BaseXContentTestCase.java


示例13: testIterable

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public void testIterable() throws Exception {
    Map<String, Iterable<?>> iterables = new HashMap<>();
    iterables.put("{'iter':null}", (Iterable) null);
    iterables.put("{'iter':[]}", Collections.emptyList());
    iterables.put("{'iter':['a','b']}", Arrays.asList("a", "b"));

    final String path = Constants.WINDOWS ? "{'iter':'path\\\\to\\\\file'}" : "{'iter':'path/to/file'}";
    iterables.put(path, PathUtils.get("path", "to", "file"));

    final String paths = Constants.WINDOWS ? "{'iter':['a\\\\b\\\\c','c\\\\d']}" : "{'iter':['a/b/c','c/d']}";
    iterables.put(paths, Arrays.asList(PathUtils.get("a", "b", "c"), PathUtils.get("c", "d")));

    for (Map.Entry<String, Iterable<?>> i : iterables.entrySet()) {
        final String expected = i.getKey();
        assertResult(expected, () -> builder().startObject().field("iter", i.getValue()).endObject());
        assertResult(expected, () -> builder().startObject().field("iter").value(i.getValue()).endObject());
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:BaseXContentTestCase.java


示例14: nodeSettings

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
@Override
protected Settings nodeSettings(int nodeOrdinal) {
            Settings.Builder settings = Settings.builder()
            .put(super.nodeSettings(nodeOrdinal))
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir());

    // if explicit, just load it and don't load from env
    try {
        if (Strings.hasText(System.getProperty("tests.config"))) {
            try {
                settings.loadFromPath(PathUtils.get(System.getProperty("tests.config")));
            } catch (IOException e) {
                throw new IllegalArgumentException("could not load aws tests config", e);
            }
        } else {
            throw new IllegalStateException("to run integration tests, you need to set -Dtests.thirdparty=true and -Dtests.config=/path/to/elasticsearch.yml");
        }
    } catch (SettingsException exception) {
        throw new IllegalStateException("your test configuration file is incorrect: " + System.getProperty("tests.config"), exception);
    }
    return settings.build();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:AbstractAwsTestCase.java


示例15: readSettingsFromFile

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
/**
 * Read settings from file when running integration tests with ThirdParty annotation.
 * elasticsearch.yml file path has to be set with -Dtests.config=/path/to/elasticsearch.yml.
 * @return Settings from elasticsearch.yml integration test file (for 3rd party tests)
 */
public static Settings readSettingsFromFile() {
    Settings.Builder settings = Settings.builder();

    // if explicit, just load it and don't load from env
    try {
        if (Strings.hasText(System.getProperty("tests.config"))) {
            try {
                settings.loadFromPath(PathUtils.get((System.getProperty("tests.config"))));
            } catch (IOException e) {
                throw new IllegalArgumentException("could not load azure tests config", e);
            }
        } else {
            throw new IllegalStateException("to run integration tests, you need to set -Dtests.thirdparty=true and " +
                "-Dtests.config=/path/to/elasticsearch.yml");
        }
    } catch (SettingsException exception) {
        throw new IllegalStateException("your test configuration file is incorrect: " + System.getProperty("tests.config"), exception);
    }
    return settings.build();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:AzureTestUtils.java


示例16: nodeSettings

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
@Override
protected Settings nodeSettings(int nodeOrdinal) {
    Settings.Builder settings = Settings.builder()
            .put(super.nodeSettings(nodeOrdinal))
            .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir())
            .put("cloud.aws.test.random", randomInt())
            .put("cloud.aws.test.write_failures", 0.1)
            .put("cloud.aws.test.read_failures", 0.1);

    // if explicit, just load it and don't load from env
    try {
        if (Strings.hasText(System.getProperty("tests.config"))) {
            try {
                settings.loadFromPath(PathUtils.get(System.getProperty("tests.config")));
            } catch (IOException e) {
                throw new IllegalArgumentException("could not load aws tests config", e);
            }
        } else {
            throw new IllegalStateException("to run integration tests, you need to set -Dtests.thirdparty=true and -Dtests.config=/path/to/elasticsearch.yml");
        }
    } catch (SettingsException exception) {
        throw new IllegalStateException("your test configuration file is incorrect: " + System.getProperty("tests.config"), exception);
    }
    return settings.build();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:AbstractAwsTestCase.java


示例17: getExtDictionarys

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public List<String> getExtDictionarys() {
	List<String> extDictFiles = new ArrayList<String>(2);
	String extDictCfg = getProperty(EXT_DICT);
	if (extDictCfg != null) {

		String[] filePaths = extDictCfg.split(";");
		for (String filePath : filePaths) {
			if (filePath != null && !"".equals(filePath.trim())) {
				Path file = PathUtils.get(filePath.trim());
				extDictFiles.add(file.toString());

			}
		}
	}
	return extDictFiles;
}
 
开发者ID:judasn,项目名称:Elasticsearch-Tutorial-zh-CN,代码行数:17,代码来源:Dictionary.java


示例18: getExtStopWordDictionarys

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
public List<String> getExtStopWordDictionarys() {
	List<String> extStopWordDictFiles = new ArrayList<String>(2);
	String extStopWordDictCfg = getProperty(EXT_STOP);
	if (extStopWordDictCfg != null) {

		String[] filePaths = extStopWordDictCfg.split(";");
		for (String filePath : filePaths) {
			if (filePath != null && !"".equals(filePath.trim())) {
				Path file = PathUtils.get(filePath.trim());
				extStopWordDictFiles.add(file.toString());

			}
		}
	}
	return extStopWordDictFiles;
}
 
开发者ID:judasn,项目名称:Elasticsearch-Tutorial-zh-CN,代码行数:17,代码来源:Dictionary.java


示例19: getIndexSettingsValidationErrors

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
List<String> getIndexSettingsValidationErrors(Settings settings) {
    String customPath = settings.get(IndexMetaData.SETTING_DATA_PATH, null);
    List<String> validationErrors = new ArrayList<>();
    if (customPath != null && env.sharedDataFile() == null) {
        validationErrors.add("path.shared_data must be set in order to use custom data paths");
    } else if (customPath != null) {
        Path resolvedPath = PathUtils.get(new Path[]{env.sharedDataFile()}, customPath);
        if (resolvedPath == null) {
            validationErrors.add("custom path [" + customPath + "] is not a sub-path of path.shared_data [" + env.sharedDataFile() + "]");
        }
    }
    Integer number_of_primaries = settings.getAsInt(IndexMetaData.SETTING_NUMBER_OF_SHARDS, null);
    Integer number_of_replicas = settings.getAsInt(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, null);
    if (number_of_primaries != null && number_of_primaries <= 0) {
        validationErrors.add("index must have 1 or more primary shards");
    }
    if (number_of_replicas != null && number_of_replicas < 0) {
        validationErrors.add("index must have 0 or more replica shards");
    }
    return validationErrors;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:22,代码来源:MetaDataCreateIndexService.java


示例20: addClasspathPermissions

import org.elasticsearch.common.io.PathUtils; //导入依赖的package包/类
/** Adds access to classpath jars/classes for jar hell scan, etc */
@SuppressForbidden(reason = "accesses fully qualified URLs to configure security")
static void addClasspathPermissions(Permissions policy) throws IOException {
    // add permissions to everything in classpath
    // really it should be covered by lib/, but there could be e.g. agents or similar configured)
    for (URL url : JarHell.parseClassPath()) {
        Path path;
        try {
            path = PathUtils.get(url.toURI());
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        // resource itself
        policy.add(new FilePermission(path.toString(), "read,readlink"));
        // classes underneath
        if (Files.isDirectory(path)) {
            policy.add(new FilePermission(path.toString() + path.getFileSystem().getSeparator() + "-", "read,readlink"));
        }
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:Security.java



注:本文中的org.elasticsearch.common.io.PathUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CheckContext类代码示例发布时间:2022-05-22
下一篇:
Java AbstractThrowableAssert类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap