You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2009/11/14 18:17:23 UTC
svn commit: r836218 - in /incubator/lucene.net/trunk/C#/src:
Lucene.Net/Analysis/WordlistLoader.cs Test/Index/TestWordlistLoader.cs
Author: digy
Date: Sat Nov 14 17:17:23 2009
New Revision: 836218
URL: http://svn.apache.org/viewvc?rev=836218&view=rev
Log:
LUCENENET-242 TestWordListLoader fails
Modified:
incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestWordlistLoader.cs
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/WordlistLoader.cs?rev=836218&r1=836217&r2=836218&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs Sat Nov 14 17:17:23 2009
@@ -102,17 +102,8 @@
System.IO.TextReader br = null;
try
{
- if (reader is System.IO.TextReader)
- {
- br = (System.IO.TextReader) reader;
- }
- else
- {
- //br = new System.IO.StreamReader(reader.BaseStream, reader.CurrentEncoding);
- System.Diagnostics.Debug.Fail("Port issue:", "Is there a need to build a StreamReader()?"); // {{Aroush-2.9}}
- }
System.String word = null;
- while ((word = br.ReadLine()) != null)
+ while ((word = reader.ReadLine()) != null)
{
SupportClass.CollectionsHelper.Add(result, word.Trim());
}
@@ -137,22 +128,14 @@
/// </param>
/// <returns> A HashSet with the reader's words
/// </returns>
- public static System.Collections.Hashtable GetWordSet(System.IO.StreamReader reader, System.String comment)
+ public static System.Collections.Hashtable GetWordSet(System.IO.TextReader reader, System.String comment)
{
System.Collections.Hashtable result = new System.Collections.Hashtable();
System.IO.StreamReader br = null;
try
{
- if (reader is System.IO.StreamReader)
- {
- br = (System.IO.StreamReader) reader;
- }
- else
- {
- br = new System.IO.StreamReader(reader.BaseStream, reader.CurrentEncoding);
- }
System.String word = null;
- while ((word = br.ReadLine()) != null)
+ while ((word = reader.ReadLine()) != null)
{
if (word.StartsWith(comment) == false)
{
Modified: incubator/lucene.net/trunk/C#/src/Test/Index/TestWordlistLoader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Index/TestWordlistLoader.cs?rev=836218&r1=836217&r2=836218&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Index/TestWordlistLoader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Index/TestWordlistLoader.cs Sat Nov 14 17:17:23 2009
@@ -43,7 +43,7 @@
public virtual void TestComments()
{
System.String s = "ONE\n two \nthree\n#comment";
- System.Collections.Hashtable wordSet1 = WordlistLoader.GetWordSet(new System.IO.StreamReader(s), "#");
+ System.Collections.Hashtable wordSet1 = WordlistLoader.GetWordSet(new System.IO.StringReader(s), "#");
CheckSet(wordSet1);
Assert.IsFalse(wordSet1.Contains("#comment"));
Assert.IsFalse(wordSet1.Contains("comment"));