metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwallen <>
Subject [GitHub] incubator-metron pull request #301: METRON-490 Stellar Validation of Require...
Date Fri, 07 Oct 2016 18:56:53 GMT
GitHub user nickwallen opened a pull request:

    METRON-490 Stellar Validation of Required Parameters

    ### [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
       SOME_FUNCTION: unexpected parameter [2]: expected class java.lang.Integer, actual class
    * If a required parameter is missing, an IllegalArgumentException is thrown with a message
        SOME_FUNCTION: parameter missing [2]: expected class java.lang.Integer

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

    $ git pull METRON-490

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

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


If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message