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

ASF GitHub Bot commented on METRON-490:
---------------------------------------

GitHub user nickwallen opened a pull request:

    https://github.com/apache/incubator-metron/pull/301

    METRON-490 Stellar Validation of Required Parameters

    ### [METRON-490](https://issues.apache.org/jira/browse/METRON-490)
    
    Currently, each Stellar function handles validation of required function 
parameters in its own way.  In some cases, we have functions that throw an 
IndexOutOfBoundsException, in other cases the function will produce its own 
error message and exception.
    
    There needs to be a standard mechanism to validate required function 
parameters.  This mechanism should handle missing parameters gracefully and 
provide an error message that makes sense to a user.  The handling should be 
accessible across all functions.
    
    ### Changes
    
    * Added an additional Stellar annotation called `requiredParams`.  
    * Added a method to `BaseStellarFunction.validate` to validate the 
`requiredParams`.
    * Use of the annotation field and validation mechanism is optional.
    * Modified the Stellar STATS_* functions to use this functionality.
    * If an incorrect type is specified, an IllegalArgumentException is thrown 
with a message like 
       ```
       SOME_FUNCTION: unexpected parameter [2]: expected class 
java.lang.Integer, actual class java.lang.String`
       ```
    * If a required parameter is missing, an IllegalArgumentException is thrown 
with a message like:
        ```
        SOME_FUNCTION: parameter missing [2]: expected class java.lang.Integer
        ```


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nickwallen/incubator-metron METRON-490

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-metron/pull/301.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #301
    
----

----


> Stellar - Validation of Required Parameters
> -------------------------------------------
>
>                 Key: METRON-490
>                 URL: https://issues.apache.org/jira/browse/METRON-490
>             Project: Metron
>          Issue Type: Bug
>            Reporter: Nick Allen
>            Assignee: Nick Allen
>
> Currently, each Stellar function handles validation of required function 
> parameters in its own way.  In some cases, we have functions that throw an 
> IndexOutOfBoundsException, in other cases the function will produce its own 
> error message and exception.
> There needs to be a standard mechanism to validate required function 
> parameters.  This mechanism should handle missing parameters gracefully and 
> provide an error message that makes sense to a user.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to