You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by wojtekpia <wo...@hotmail.com> on 2009/12/01 01:04:10 UTC
Character Escape in QueryParsing.StrParser.getQuotedString()
I'm confused by the following code snippet in
QueryParsing.StrParser.getQuotedString().
626 char ch = val.charAt(pos);
627 if (ch=='\\') {
628 ch = pos<end ? val.charAt(pos++) : 0;
629 } else if (ch==delim) {
630 pos++;
631 return sb.toString();
632 }
It seems like if line 627 is true, then line 628 will always assign ch='\\'.
Should line 628 have a pre-increment instead of post-increment on the 'pos'
variable? i.e.
626 char ch = val.charAt(pos);
627 if (ch=='\\') {
628 ch = pos<end ? val.charAt(++pos) : 0;
629 } else if (ch==delim) {
630 pos++;
631 return sb.toString();
632 }
--
View this message in context: http://old.nabble.com/Character-Escape-in-QueryParsing.StrParser.getQuotedString%28%29-tp26584376p26584376.html
Sent from the Solr - Dev mailing list archive at Nabble.com.
Re: Character Escape in QueryParsing.StrParser.getQuotedString()
Posted by Yonik Seeley <yo...@lucidimagination.com>.
Thanks for the report - that definitely looks wrong. I've opened
https://issues.apache.org/jira/browse/SOLR-1615
-Yonik
http://www.lucidimagination.com
On Mon, Nov 30, 2009 at 7:04 PM, wojtekpia <wo...@hotmail.com> wrote:
>
> I'm confused by the following code snippet in
> QueryParsing.StrParser.getQuotedString().
>
> 626 char ch = val.charAt(pos);
> 627 if (ch=='\\') {
> 628 ch = pos<end ? val.charAt(pos++) : 0;
> 629 } else if (ch==delim) {
> 630 pos++;
> 631 return sb.toString();
> 632 }
>
> It seems like if line 627 is true, then line 628 will always assign ch='\\'.
> Should line 628 have a pre-increment instead of post-increment on the 'pos'
> variable? i.e.
>
> 626 char ch = val.charAt(pos);
> 627 if (ch=='\\') {
> 628 ch = pos<end ? val.charAt(++pos) : 0;
> 629 } else if (ch==delim) {
> 630 pos++;
> 631 return sb.toString();
> 632 }
> --
> View this message in context: http://old.nabble.com/Character-Escape-in-QueryParsing.StrParser.getQuotedString%28%29-tp26584376p26584376.html
> Sent from the Solr - Dev mailing list archive at Nabble.com.
>
>