[GitHub] incubator-metron pull request #301: METRON-490 Stellar Validation of Require...

2016-11-28 Thread nickwallen
Github user nickwallen closed the pull request at:

https://github.com/apache/incubator-metron/pull/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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request #301: METRON-490 Stellar Validation of Require...

2016-10-07 Thread nickwallen
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






---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---