metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From justinleet <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #300: METRON-489: RemoveSubdomains Stellar Fun...
Date Fri, 07 Oct 2016 12:25:17 GMT
Github user justinleet commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/300#discussion_r82378741
  
    --- Diff: metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/NetworkFunctions.java
---
    @@ -78,13 +78,16 @@ public Object apply(List<Object> list) {
     
         @Override
         public Object apply(List<Object> objects) {
    +      if(objects.isEmpty()) {
    +        return null;
    +      }
           Object dnObj = objects.get(0);
           InternetDomainName idn = toDomainName(dnObj);
           if(idn != null) {
             String dn = dnObj.toString();
             String tld = idn.publicSuffix().toString();
    -        String suffix = Iterables.getFirst(Splitter.on(tld).split(dn), null);
    -        if(suffix != null)
    +        String suffix = dn.substring(0, dn.length() - tld.length());
    +        if(suffix != null )
    --- End diff --
    
    Could you just drop this if-else?  Substring never returns null, so it can be dropped
entirely.


---
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