You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Munendra S N (Jira)" <ji...@apache.org> on 2019/10/14 04:45:00 UTC

[jira] [Commented] (SOLR-13824) JSON Request API ignores prematurely closing curly brace.

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

Munendra S N commented on SOLR-13824:
-------------------------------------

Hey [~mkhl]
Few other observations
* In some cases, Utils.fromJSON is used which calls {{getVal()}} directly.
* [CommandOperation|https://github.com/apache/lucene-solr/blob/b6ea7d60b7005d29400161eae291e51697a11b05/solr/solrj/src/java/org/apache/solr/common/util/CommandOperation.java#L268] also calls {{getVal()}} directly. I was able to reproduce the issue with here too

So, I was thinking probably a fix might need changes in {{getVal()}}
Something like
{code:java}
public Object getVal(boolean validateEOF) {
Object val = _getVal();
// validate for EOF
return val;
}
public Object getVal() {
return getVal(true);
}
{code}
Current, {{getVal}} becomes {{_getVal}}
So, by default we validate EOF and commandOperation can disable this and handle separately

Current patch LGTM as it fixes in JSON request API. It would be great if we could fix all such issues irrespective of the API.
If we are going ahead with the current patch then few suggestions
* can we please {{expectThrows}} to validate exception thrown
* {{Throws \{@link IllegalArgumentException} otherwise}}, I think this should have been {{Throws \{@link ParseException} otherwise}}

Also, I was able to reproduce this issue for extra }. Is there any other scenario where we could enter same issue. If so, patch would still work but we might need to change the error message

> JSON Request API ignores prematurely closing curly brace. 
> ----------------------------------------------------------
>
>                 Key: SOLR-13824
>                 URL: https://issues.apache.org/jira/browse/SOLR-13824
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: JSON Request API
>            Reporter: Mikhail Khludnev
>            Priority: Major
>         Attachments: SOLR-13824.patch
>
>
> {code:java}
> json={query:"content:foo", facet:{zz:{field:id}}}
> {code}
> this works fine, but if we mistype {{}}} instead of {{,}}
> {code:java}
> json={query:"content:foo"} facet:{zz:{field:id}}}
> {code}
> It's captured only partially, here's we have under debug
> {code:java}
>   "json":{"query":"content:foo"},
> {code}
> I suppose it should throw an error with 400 code.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org