public void setQuery(CharSequence query) { this.query = query; this.message = new MessageImpl( QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, ""); }
/** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); }
public void setQuery(CharSequence query) { this.query = query; this.message = new MessageImpl( QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, ""); }
/** * The following constructors are for use by you for whatever purpose you can think of. Constructing the exception in this manner makes the exception behave * in the normal way - i.e., as documented in the class "Throwable". The fields "errorToken", "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use these constructors. */ public ParseException() { super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); }
/** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, "Error")); }
/** Returns the numeric value of the hexadecimal character */ private static final int hexToInt(char c) throws ParseException { if ('0' <= c && c <= '9') { return c - '0'; } else if ('a' <= c && c <= 'f') { return c - 'a' + 10; } else if ('A' <= c && c <= 'F') { return c - 'A' + 10; } else { throw new ParseException(new MessageImpl(QueryParserMessages.INVALID_SYNTAX_ESCAPE_NONE_HEX_UNICODE, c)); } }
/** Returns the numeric value of the hexadecimal character */ private static final int hexToInt(char c) throws ParseException { if ('0' <= c && c <= '9') { return c - '0'; } else if ('a' <= c && c <= 'f') { return c - 'a' + 10; } else if ('A' <= c && c <= 'F') { return c - 'A' + 10; } else { throw new ParseException(new MessageImpl( QueryParserMessages.INVALID_SYNTAX_ESCAPE_NONE_HEX_UNICODE, c)); } }
/** * This constructor is used by the method "generateParseException" in the generated parser. Calling this constructor generates a new object of this type * with the fields "currentToken", "expectedTokenSequences", and "tokenImage" set. */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) { super(new MessageImpl(QueryParserMessages.INVALID_SYNTAX, initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal))); this.currentToken = currentTokenVal; this.expectedTokenSequences = expectedTokenSequencesVal; this.tokenImage = tokenImageVal; }
private Analyzer getAnalyzer(String datatype) throws QueryNodeException { final Analyzer analyzer = this.getQueryConfigHandler() .get(KeywordConfigurationKeys.DATATYPES_ANALYZERS) .get(datatype); if (analyzer == null) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.INVALID_SYNTAX, "No analyzer associated with " + datatype)); } return analyzer; }
@Override protected QueryNode postProcessNode(final QueryNode node) throws QueryNodeException { if (node instanceof TwigQueryNode) { final TwigQueryNode twig = (TwigQueryNode) node; if (twig.getChild() instanceof WildcardNodeQueryNode && twig.getRoot() instanceof WildcardNodeQueryNode) { throw new QueryNodeException(new MessageImpl("Twig with both root and child empty is not allowed.")); } } return node; }
/** * This QueryNode is used to identify parenthesis on the original query string */ public GroupQueryNode(QueryNode query) { if (query == null) { throw new QueryNodeError(new MessageImpl( QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, "query", "null")); } allocate(); setLeaf(false); add(query); }
/** * This QueryNode is used to identify parenthesis on the original query string */ public GroupQueryNode(QueryNode query) { if (query == null) { throw new QueryNodeError(new MessageImpl( QueryParserMessages.PARAMETER_VALUE_NOT_SUPPORTED, "query", "null")); } allocate(); setLeaf(false); add(query); }
/** * @exception QueryNodeError throw in overridden method to disallow */ public PhraseSlopQueryNode(QueryNode query, int value) { if (query == null) { throw new QueryNodeError(new MessageImpl( QueryParserMessages.NODE_ACTION_NOT_SUPPORTED, "query", "null")); } this.value = value; setLeaf(false); allocate(); add(query); }
@Override public MatchAllDocsQuery build(QueryNode queryNode) throws QueryNodeException { // validates node if (!(queryNode instanceof MatchAllDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .toQueryString(new EscapeQuerySyntaxImpl()), queryNode.getClass() .getName())); } return new MatchAllDocsQuery(); }
public NodeBooleanQuery build(final QueryNode queryNode) throws QueryNodeException { // validates node if (!(queryNode instanceof MatchNoDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .toQueryString(new EscapeQuerySyntaxImpl()), queryNode.getClass() .getName())); } return new NodeBooleanQuery(); }
@Override public MatchNoDocsQuery build(QueryNode queryNode) throws QueryNodeException { // validates node if (!(queryNode instanceof MatchNoDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .toQueryString(new EscapeQuerySyntaxImpl()), queryNode.getClass() .getName())); } return new MatchNoDocsQuery(); }
@Override public MatchNoDocsQuery build(QueryNode queryNode) throws QueryNodeException { // validates node if (!(queryNode instanceof MatchNoDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .toQueryString(new EscapeQuerySyntaxImpl()), queryNode.getClass() .getName())); } return new MatchNoDocsQuery(); }
@Override public MatchAllDocsQuery build(QueryNode queryNode) throws QueryNodeException { // validates node if (!(queryNode instanceof MatchAllDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .toQueryString(new EscapeQuerySyntaxImpl()), queryNode.getClass() .getName())); } return new MatchAllDocsQuery(); }
@Override protected QueryNode postProcessNode(final QueryNode node) throws QueryNodeException { if (node instanceof WildcardQueryNode) { throw new QueryNodeException(new MessageImpl("Wildcard not allowed", node .toQueryString(new EscapeQuerySyntaxImpl()))); } if (node instanceof FuzzyQueryNode) { throw new QueryNodeException(new MessageImpl("Fuzzy not allowed", node .toQueryString(new EscapeQuerySyntaxImpl()))); } return node; }
public JexlNode build(QueryNode queryNode) throws QueryNodeException { TermRangeQueryNode rangeNode = (TermRangeQueryNode) queryNode; FieldQueryNode lower = rangeNode.getLowerBound(); FieldQueryNode upper = rangeNode.getUpperBound(); boolean lowerWildcard = lower.getTextAsString().equals("*"); boolean upperWildcard = upper.getTextAsString().equals("*"); if (lowerWildcard && upperWildcard) { throw new QueryNodeException(new MessageImpl("Wildcard of lower and upper bouds not allowed")); } String field = rangeNode.getField().toString(); return new JexlRangeNode(field, lower.getTextAsString(), upper.getTextAsString(), rangeNode.isLowerInclusive(), rangeNode.isUpperInclusive()); }