Jack Krupansky created SOLR-4424:
------------------------------------

             Summary: Solr should complain if a parameter has no name in 
solrconfig.xml
                 Key: SOLR-4424
                 URL: https://issues.apache.org/jira/browse/SOLR-4424
             Project: Solr
          Issue Type: Bug
          Components: Schema and Analysis
    Affects Versions: 4.0
            Reporter: Jack Krupansky


Solr should complain with an appropriate message if the 'name' attribute is 
missing for a parameter in solrconfig.xml, such as for the "defaults" 
parameters for a request handler.

Repro:

Add this snippet to solrconfig.xml:

{code}
  <requestHandler name="/testBug" class="solr.SearchHandler">
    <lst name="defaults">
      <str Name="df">name</str>
    </lst>
  </requestHandler>
{code}

Here the user error is "Name" which should be lower-case "name".

Start Solr.

No complaint from Solr that the "name" attribute is missing. In this case, the 
spelling of the attribute name is correct, but the case is wrong - "Name" vs. 
"name".

The DOMUtil.addToNamedList method fetches and uses the "name" attribute without 
checking to see if it might be null or missing:

{code}
    final String name = getAttr(nd, "name");

    ...

    if (nlst != null) nlst.add(name,val);
{code}

I suggest that if the "name" attribute is null or missing an exception will be 
thrown that says "Named list element is missing 'name' attribute" and the full 
text of the element with whatever attributes it does have and its value text. 
Is there a way to get the line number?


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to