You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Dominic Dsouza (JIRA)" <ji...@apache.org> on 2015/11/02 13:37:27 UTC

[jira] [Updated] (LUCENE-6876) QueryNodeParseException is thrown without proper Error information

     [ https://issues.apache.org/jira/browse/LUCENE-6876?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominic Dsouza updated LUCENE-6876:
-----------------------------------
    Description: 
Whenever an Error is caught in parse() method of  StandardSyntaxParser.java, a new instance of QueryNodeParseException is created without any Error Information(like errorToken, beginColumn, beginLine) and thrown. Following is the parse method:

{code}
public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException {
      ReInit(new FastCharStream(new StringReader(query.toString())));
      try {
        // TopLevelQuery is a Query followed by the end-of-input (EOF)
        QueryNode querynode = TopLevelQuery(field);
        return querynode;
      }
      catch (ParseException tme) {
            tme.setQuery(query);
            throw tme;
      }
      catch (Error tme) {
          Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage());
          QueryNodeParseException e = new QueryNodeParseException(tme);
            e.setQuery(query);
            e.setNonLocalizedMessage(message);
            throw e;
      }
    }
{code}

  was:
Whenever an Error is caught in parse() method of  StandardSyntaxParser.java, a new instance of QueryNodeParseException is created without any Error Information(like errorToken, beginColumn, beginLine) and thrown. Following is the parse method:

public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException {
      ReInit(new FastCharStream(new StringReader(query.toString())));
      try {
        // TopLevelQuery is a Query followed by the end-of-input (EOF)
        QueryNode querynode = TopLevelQuery(field);
        return querynode;
      }
      catch (ParseException tme) {
            tme.setQuery(query);
            throw tme;
      }
      catch (Error tme) {
          Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage());
          QueryNodeParseException e = new QueryNodeParseException(tme);
            e.setQuery(query);
            e.setNonLocalizedMessage(message);
            throw e;
      }
    }



> QueryNodeParseException is thrown without proper Error information
> ------------------------------------------------------------------
>
>                 Key: LUCENE-6876
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6876
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/queryparser
>    Affects Versions: 5.3
>            Reporter: Dominic Dsouza
>
> Whenever an Error is caught in parse() method of  StandardSyntaxParser.java, a new instance of QueryNodeParseException is created without any Error Information(like errorToken, beginColumn, beginLine) and thrown. Following is the parse method:
> {code}
> public QueryNode parse(CharSequence query, CharSequence field) throws QueryNodeParseException {
>       ReInit(new FastCharStream(new StringReader(query.toString())));
>       try {
>         // TopLevelQuery is a Query followed by the end-of-input (EOF)
>         QueryNode querynode = TopLevelQuery(field);
>         return querynode;
>       }
>       catch (ParseException tme) {
>             tme.setQuery(query);
>             throw tme;
>       }
>       catch (Error tme) {
>           Message message = new MessageImpl(QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, tme.getMessage());
>           QueryNodeParseException e = new QueryNodeParseException(tme);
>             e.setQuery(query);
>             e.setNonLocalizedMessage(message);
>             throw e;
>       }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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