Use PathUtils instead of Paths

This commit is contained in:
David Pilato 2017-02-03 16:08:51 +01:00
parent 4c3466709a
commit 4775f520f4
1 changed files with 2 additions and 2 deletions

View File

@ -22,12 +22,12 @@ package org.elasticsearch.ingest.attachment;
import org.apache.lucene.util.LuceneTestCase.SuppressFileSystems; import org.apache.lucene.util.LuceneTestCase.SuppressFileSystems;
import org.apache.lucene.util.TestUtil; import org.apache.lucene.util.TestUtil;
import org.apache.tika.metadata.Metadata; import org.apache.tika.metadata.Metadata;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.ESTestCase;
import java.nio.file.DirectoryStream; import java.nio.file.DirectoryStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths;
/** /**
* Evil test-coverage cheat, we parse a bunch of docs from tika * Evil test-coverage cheat, we parse a bunch of docs from tika
@ -43,7 +43,7 @@ public class TikaDocTests extends ESTestCase {
public void testFiles() throws Exception { public void testFiles() throws Exception {
Path tmp = createTempDir(); Path tmp = createTempDir();
logger.debug("unzipping all tika sample files"); logger.debug("unzipping all tika sample files");
try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(getClass().getResource(TIKA_FILES).toURI()))) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(PathUtils.get(getClass().getResource(TIKA_FILES).toURI()))) {
for (Path doc : stream) { for (Path doc : stream) {
String filename = doc.getFileName().toString(); String filename = doc.getFileName().toString();
TestUtil.unzip(getClass().getResourceAsStream(TIKA_FILES + filename), tmp); TestUtil.unzip(getClass().getResourceAsStream(TIKA_FILES + filename), tmp);