Apache Solr open-source search software
LUCENE-5945: Cleanup & javadocs
Uwe Schindleraf287593c839
diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.javaindex d9dd7c99963..c9fc75f6687 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java@@ -1663,9 +1663,9 @@ public abstract class LuceneTestCase extends Assert {}/**- * Gets a resource from the classpath as {@link Path}. This method should only+ * Gets a resource from the test's classpath as {@link Path}. This method should only* be used, if a real file is needed. To get a stream, code should prefer- * {@link Class#getResourceAsStream} using {@code this.getClass()}.+ * {@link #getDataInputStream(String)}.*/protected Path getDataPath(String name) throws IOException {try {@@ -1675,12 +1675,15 @@ public abstract class LuceneTestCase extends Assert {}}+ /**+ * Gets a resource from the test's classpath as {@link InputStream}.+ */protected InputStream getDataInputStream(String name) throws IOException {- try {- return this.getClass().getResourceAsStream(name);- } catch (Exception e) {+ InputStream in = this.getClass().getResourceAsStream(name);+ if (in == null) {throw new IOException("Cannot find resource: " + name);}+ return in;}public void assertReaderEquals(String info, IndexReader leftReader, IndexReader rightReader) throws IOException {diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.javaindex 1b723f77308..35ac91c49e7 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java@@ -28,7 +28,6 @@ import java.nio.CharBuffer;import java.nio.file.Files;import java.nio.file.Path;import java.util.Arrays;-import java.util.Enumeration;import java.util.HashMap;import java.util.List;import java.util.Map;@@ -108,6 +107,7 @@ public final class TestUtil {try (ZipInputStream zipInput = new ZipInputStream(in)) {ZipEntry entry;+ byte[] buffer = new byte[8192];while ((entry = zipInput.getNextEntry()) != null) {Path targetFile = destDir.resolve(entry.getName());@@ -116,7 +116,6 @@ public final class TestUtil {Files.createDirectories(targetFile.getParent());if (!entry.isDirectory()) {OutputStream out = Files.newOutputStream(targetFile);- byte[] buffer = new byte[8192];int len;while((len = zipInput.read(buffer)) >= 0) {out.write(buffer, 0, len);