[jira] Updated: (SOLR-183) add getRequiredParameter() to SolrParams
[ https://issues.apache.org/jira/browse/SOLR-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] J.J. Larrea updated SOLR-183: - Attachment: SOLR-183-required-param.patch 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, 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.
[jira] Updated: (SOLR-183) add getRequiredParameter() to SolrParams
[ 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 Looks good. thanks. I agree it is cleaner as a decorator. As a decorator, I think getInt( 'xxx', defaultVal ) shoould work, not throw an exception. I don't follow the strict/not strict logic to getFieldParam... If you don't want strict checking, use the normal SolrParams, if you do, use RequiredSolrParams This update changes things so the basic contract with RequiredSolrParams is that you get back a valid non-null value (unless you pass it in as a default) * functions with default values call the wrapped params directly * replaced tabs with 2 spaces * removed the 'strict' field logic 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, 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.
[jira] Updated: (SOLR-183) add getRequiredParameter() to SolrParams
[ https://issues.apache.org/jira/browse/SOLR-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] J.J. Larrea updated SOLR-183: - Attachment: RequiredSolrParams.java 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 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.
[jira] Updated: (SOLR-183) add getRequiredParameter() to SolrParams
[ 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 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: 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.