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

[jira] [Comment Edited] (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=13576274#comment-13576274 ] 

Jack Krupansky edited comment on SOLR-4424 at 2/12/13 1:19 AM:
---------------------------------------------------------------

It may be technically true that the NameList class and some use cases for "<lst>" may support anonymous parameters, but I'm concerned about Solr parameters.

I'll extend the original issue description to include detection and reporting of other forms of unreasonable names for "SolrParams" parameters:

{code}
  <str>abc</str>  <!-- No parameter "name" attribute specified -->
  <str name="">abc</str>  <!-- Empty parameter "name" attribute specified -->
  <str name="    ">abc</str>   <!-- Empty parameter "name" attribute specified - trim white space -->
  <str name="  q  ">abc</str>   <!-- Make sure to trim parameter names of white space -->
  <str name="@@q%%//">abc</str>   <!-- Limit parameter names to alpha, digit, underscore, hyphen, and dot -->
{code}

Also, when I say "parameter", I mean the top level for a plugin (or child plugin as for spellcheckers) or an element of a "lst". The elements of an "arr" are a separate case:

{code}
       <arr name="components">
         <str>nameOfCustomComponent1</str>  <!-- OKAY to be be anonymous for an "array" -->
         <str>nameOfCustomComponent2</str>
       </arr>
{code}

Does anybody know of any solrconfig.xml use cases for anonymous parameter names? Or, is it basically only the immediate children of "arr" that can reasonably be unnamed?


                
      was (Author: jkrupan):
    It may be technically true that the NameList class and some use cases for "<lst>" may support anonymous parameters, I'm concerned about Solr parameters.

I'll extend the original issue description to include detection and reporting of other forms of unreasonable names for "SolrParams" parameters:

{code}
  <str>abc</str>  <!-- No parameter "name" attribute specified -->
  <str name="">abc</str>  <!-- Empty parameter "name" attribute specified -->
  <str name="    ">abc</str>   <!-- Empty parameter "name" attribute specified - trim white space -->
  <str name="  q  ">abc</str>   <!-- Make sure to trim parameter names of white space -->
  <str name="@@q%%//">abc</str>   <!-- Limit parameter names to alpha, digit, underscore, hyphen, and dot -->
{code}

Also, when I say "parameter", I mean the top level for a plugin (or child plugin as for spellcheckers) or an element of a "lst". The elements of an "arr" are a separate case:

{code}
       <arr name="components">
         <str>nameOfCustomComponent1</str>  <!-- OKAY to be be anonymous for an "array" -->
         <str>nameOfCustomComponent2</str>
       </arr>
{code}

Does anybody know of any solrconfig.xml use cases for anonymous parameter names? Or, is it basically only the immediate children of "arr" that can reasonably be unnamed?


                  
> 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