You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2013/02/12 00:05:12 UTC

[jira] [Commented] (SOLR-4424) Solr should complain if a parameter has no name in solrconfig.xml

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

Hoss Man commented on SOLR-4424:
--------------------------------

bq. 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"

NamedList does not in require that every item in the list have a name - it is a list of items which _may_ have names -- 'null' (ie: not specifing a 'name' attribute in the XML) is perfectly valid for this type of datastructure.

Perhaps a cleaner fix of the underlying problem you want to avoid would be to update the XML parsing code to complain if any _other_ unexpected attributes (ie: "Name") are found?

patches welcome
                
> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org