Skip to content

Commit

Permalink
Leave debugStream as null on construction of parser token managers
Browse files Browse the repository at this point in the history
* When debugStream is set to Console.Out by default, StandardSyntaxParserTokenManager throws an exception when constructing a StandardQueryParser on OSes that do not support System.Console, such as iOS and Android.
* debugStream can be set later using the setter, if needed.
* The above is the same for QueryParserTokenManager when constructing a QueryParser.
* See issue apache#936 for details.
  • Loading branch information
JayOfemi committed Jun 11, 2024
1 parent 38a7b53 commit 331174c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Lucene.Net.QueryParser/Classic/QueryParserTokenManager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lucene.Net.Support.IO;
using Lucene.Net.Support.IO;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
Expand Down Expand Up @@ -31,7 +31,7 @@ public class QueryParserTokenManager //: QueryParserConstants
{
/// <summary>Debug output. </summary>
#pragma warning disable IDE0052 // Remove unread private members
private TextWriter debugStream = Console.Out; // LUCENENET specific - made private, since we already have a setter
private TextWriter debugStream; // LUCENENET specific - made private, since we already have a setter
#pragma warning restore IDE0052 // Remove unread private members
/// <summary>Set debug output. </summary>
public virtual void SetDebugStream(TextWriter ds)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Lucene.Net.Support.IO;
using Lucene.Net.Support.IO;
using System.Diagnostics.CodeAnalysis;
using System;
using System.IO;
Expand Down Expand Up @@ -32,7 +32,7 @@ public class StandardSyntaxParserTokenManager /*: StandardSyntaxParserConstants*
{
/// <summary>Debug output.</summary>
#pragma warning disable IDE0052 // Remove unread private members
private TextWriter debugStream = Console.Out; // LUCENENET specific - made private, since we already have a setter
private TextWriter debugStream; // LUCENENET specific - made private, since we already have a setter
#pragma warning restore IDE0052 // Remove unread private members
/// <summary>Set debug output.</summary>
public void SetDebugStream(TextWriter ds) { debugStream = new SafeTextWriterWrapper(ds); }
Expand Down

0 comments on commit 331174c

Please sign in to comment.