[ 
https://issues.apache.org/jira/browse/SOLR-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ryan McKinley updated SOLR-183:
-------------------------------

    Attachment: SOLR-183-required-param.patch

This update changes some things in response to JJ's comments.

I agree the "well-formed or not" check should be directly in SolrParams - there 
is no reason to throw a 500 exception for rather then a 400 for bad input.

That leaves the one open question:
Should getRequiredXXX() go directly in SolrParams or be implemented as a 
decorator?

This patch puts it directly in SolrParams (I don't care either way, I just want 
something so that I don't rewrite it for every custom handler).  It also adds a 
test case for SolrParams.


JJ, can we move the RequiredSolrParams.java to a different issue?  It seems 
like a reasonable proposal but it does help the reason i opened this issue: a 
standard/quick way for the RequestHandler author to make sure parameters are 
specified.  



> add getRequiredParameter() to SolrParams
> ----------------------------------------
>
>                 Key: SOLR-183
>                 URL: https://issues.apache.org/jira/browse/SOLR-183
>             Project: Solr
>          Issue Type: Wish
>            Reporter: Ryan McKinley
>            Priority: Trivial
>         Attachments: RequiredSolrParams.java, SOLR-183-required-param.patch, 
> SOLR-183-required-param.patch, SOLR-183-required-param.patch
>
>
> I find myself including this with every patch, so i'll just separate it out.  
> This simply adds a utilty function to SolrParams that throws a 400 if the 
> parameter is missing:
> /** returns the value of the param, or throws a 400 exception if missing */
>   public String getRequiredParameter(String param) throws SolrException {
>     String val = get(param);
>     if( val == null ) {
>       throw new SolrException( 400, "Missing parameter: "+param );
>     }
>     return val;
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to