metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattf-horton <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #516: METRON-830 Adding StringFunctions to Ste...
Date Fri, 07 Apr 2017 00:18:59 GMT
Github user mattf-horton commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/516#discussion_r110270759
  
    --- Diff: metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/StringFunctions.java
---
    @@ -343,4 +343,89 @@ public Object apply(List<Object> args) {
           return String.format(format, formatArgs);
         }
       }
    +
    +  @Stellar( name="CHOP"
    +          , description = "Remove the last character from a String"
    +          , params = { "the String to chop last character from, may be null"}
    +          , returns = "String without last character, null if null String input"
    +  )
    +  public static class chop extends BaseStellarFunction {
    +
    +    @Override
    +    public Object apply(List<Object> strings) {
    +
    +      if(strings.size() == 0) {
    +        throw new IllegalArgumentException("[CHOP] missing argument: string to be chopped");
    --- End diff --
    
    Seems like if an empty string gives IAE, then so should a null argument.  But I could
also support returning the empty string for an empty string, and null for null.


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

Mime
View raw message