lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r759061 - /lucene/java/trunk/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java
Date Fri, 27 Mar 2009 08:44:36 GMT
Author: mikemccand
Date: Fri Mar 27 08:44:33 2009
New Revision: 759061

URL: http://svn.apache.org/viewvc?rev=759061&view=rev
Log:
remove slow download host; only download zip file once for all tests

Modified:
    lucene/java/trunk/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java

Modified: lucene/java/trunk/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java?rev=759061&r1=759060&r2=759061&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java
(original)
+++ lucene/java/trunk/contrib/analyzers/src/test/org/apache/lucene/analysis/compound/TestCompoundWordTokenFilter.java
Fri Mar 27 08:44:33 2009
@@ -46,7 +46,9 @@
       "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 @@
   }
 
   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;
+    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);
+        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
     }
   }
 



Mime
View raw message