Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.9
    • Fix Version/s: None
    • Component/s: core/queryparser
    • Labels:
      None
    • Lucene Fields:
      New

      Description

        public Query build(QueryNode queryNode) throws QueryNodeException {
          BoostQueryNode boostNode = (BoostQueryNode) queryNode;
          QueryNode child = boostNode.getChild();
      
          if (child == null) {
            return null;
          }
      
          Query query = (Query) child
              .getTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID);
          query.setBoost(boostNode.getValue());
      
          return query;
      
        }
      

      In BoostQueryNodeBuilder.build, the return variable, "query" can be null, but there is no error handling code for the return variable. I think there should be a null checker for query like for child.

      <Test Case>

      public void test1() throws Throwable {
           BoostQueryNodeBuilder builder = new BoostQueryNodeBuilder();
           QuotedFieldQueryNode quotedNode = new QuotedFieldQueryNode((java.lang.CharSequence)"hi!", (java.lang.CharSequence)"", 10, 100);
           BoostQueryNode node = new BoostQueryNode((QueryNode)quotedNode, 2.0f);
           builder.build((QueryNode)node);
      }
      

      <Stack Trace>

      1) test1(Test0)java.lang.NullPointerException
              at org.apache.lucene.queryparser.flexible.standard.builders.BoostQueryNodeBuilder.build(BoostQueryNodeBuilder.java:49)
              at Test0.test1(Test0.java:4809)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mjkim0324 M Kim
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: