[ 
https://issues.apache.org/jira/browse/LUCENENET-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16122209#comment-16122209
 ] 

Shad Storhaug commented on LUCENENET-592:
-----------------------------------------

Thanks for the report.

These "bugs" were copied over from Lucene 
(https://github.com/apache/lucene-solr/blob/releases/lucene-solr/4.8.0/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/util/UnescapedCharSequence.java#L56-L64).
 Since the constructor was made private, it apparently isn't for outside use 
(however, I can't really explain what it would be for if it is decorated with 
the {{@SuppressWarnings("unused")}} attribute).

If you need to pass an {{UnescapedCharSequence}} to create a new one, you can 
use the {{public UnescapedCharSequence(ICharSequence text)}} overload because 
{{UnescapedCharSequence}} implements {{ICharSequence}}.

That said, we are missing an overload here for passing in a {{StringBuilder}} - 
in Java both {{String}} and {{StringBuilder}} implement {{ICharSequence}}, so 
in .NET we need an overload for all three (including {{ICharSequence}}) to 
mimic that behavior since there is no shared interface between these types in 
.NET.

> Lucene.Net.QueryParsers.Flexible.Core.Util.UnescapedCharSequence
> ----------------------------------------------------------------
>
>                 Key: LUCENENET-592
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-592
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net.QueryParser
>    Affects Versions: Lucene.Net 4.8.0
>         Environment: .NET 4.5.1/4.6.2
>            Reporter: Greg Mulvihill
>
> I noticed a few things that seem to be bugs in UnescapedCharSequence.cs.  
> https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.QueryParser/Flexible/Core/Util/UnescapedCharSequence.cs
> Line 77: I found no reference to the private constructor 
> UnescapedCharSequence(UnescapedCharSequence text), but needed to use it.
> Line 81: The for loop throws an exception as the condition statement goes 
> beyond the length of text due to '<=', rather than '<'.
> Line 128: The for loop immediately terminates as i will always fail the 
> condition statement.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to