lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dor...@apache.org
Subject svn commit: r1417871 - /lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSourceTest.java
Date Thu, 06 Dec 2012 13:33:36 GMT
Author: doronc
Date: Thu Dec  6 13:33:34 2012
New Revision: 1417871

URL: http://svn.apache.org/viewvc?rev=1417871&view=rev
Log:
LUCENE-4588 (cont): (EnwikiContentSource fixes) avoid using the forbidden StringBufferInputStream..

Modified:
    lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSourceTest.java

Modified: lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSourceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSourceTest.java?rev=1417871&r1=1417870&r2=1417871&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSourceTest.java
(original)
+++ lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSourceTest.java
Thu Dec  6 13:33:34 2012
@@ -17,14 +17,17 @@ package org.apache.lucene.benchmark.byTa
  * limitations under the License.
  */
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStreamWriter;
 import java.text.ParseException;
 import java.util.Properties;
 
 import org.apache.lucene.benchmark.byTask.utils.Config;
+import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class EnwikiContentSourceTest extends LuceneTestCase {
@@ -38,10 +41,16 @@ public class EnwikiContentSourceTest ext
       this.docs = docs;
     }
     
-    @SuppressWarnings("deprecation") // fine for the characters used in this test
     @Override
     protected InputStream openInputStream() throws IOException {
-      return new java.io.StringBufferInputStream(docs);
+      // StringBufferInputStream would have been handy, but it is forbidden
+      ByteArrayOutputStream baos = new ByteArrayOutputStream();
+      OutputStreamWriter w = new OutputStreamWriter(baos, IOUtils.CHARSET_UTF_8);
+      w.write(docs);
+      w.close();
+      byte[] byteArray = baos.toByteArray();
+      baos.close();
+      return new ByteArrayInputStream(byteArray);
     }
 
   }



Mime
View raw message