prepare Hudson's large line doc file

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1044867 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2010-12-12 18:04:25 +00:00
parent 3da3f2fad2
commit bc72163b4c
1 changed files with 4 additions and 3 deletions

View File

@ -18,7 +18,7 @@ package org.apache.lucene.util;
*/
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
@ -63,9 +63,10 @@ public class LineFileDocs implements Closeable {
private synchronized void open() throws IOException {
InputStream is = getClass().getResourceAsStream(path);
if (is == null) {
throw new FileNotFoundException("cannot find line docs resource \"" + path + "\"");
// if its not in classpath, we load it as absolute filesystem path (e.g. Hudson's home dir)
is = new FileInputStream(path);
}
if (path.toString().endsWith(".gz")) {
if (path.endsWith(".gz")) {
is = new GZIPInputStream(is);
}
final InputStream in = new BufferedInputStream(is, BUFFER_SIZE);