Apache Lucene open-source search software
remove slow download host; only download zip file once for all tests
Michael McCandless0f17904f1e7b
diff --git a/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java b/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.javaindex 394955be18a..581d47ebf52 100644--- a/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java+++ b/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java@@ -46,7 +46,9 @@ public class TestCompoundWordTokenFilter extends TestCase {"http://dfn.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip","http://surfnet.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip","http://superb-west.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip",- "http://superb-east.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip"};+ "http://voxel.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip"};+ // too slow:+ //"http://superb-east.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip"};private byte[] patternsFileContent;@@ -166,23 +168,25 @@ public class TestCompoundWordTokenFilter extends TestCase {}private void getHyphenationPatternFileContents() {- try {- List urls = new LinkedList(Arrays.asList(locations));- Collections.shuffle(urls);- URL url = new URL((String)urls.get(0));- InputStream in = url.openStream();- byte[] buffer = new byte[1024];- ByteArrayOutputStream out = new ByteArrayOutputStream();- int count;-- while ((count = in.read(buffer)) != -1) {- out.write(buffer, 0, count);+ if (patternsFileContent == null) {+ try {+ List urls = new LinkedList(Arrays.asList(locations));+ Collections.shuffle(urls);+ URL url = new URL((String)urls.get(0));+ InputStream in = url.openStream();+ byte[] buffer = new byte[1024];+ ByteArrayOutputStream out = new ByteArrayOutputStream();+ int count;++ while ((count = in.read(buffer)) != -1) {+ out.write(buffer, 0, count);+ }+ in.close();+ out.close();+ patternsFileContent = out.toByteArray();+ } catch (IOException e) {+ // we swallow all exceptions - the user might have no internet connection}- in.close();- out.close();- patternsFileContent = out.toByteArray();- } catch (IOException e) {- // we swallow all exceptions - the user might have no internet connection}}