accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] accumulo pull request #111: ACCUMULO-4331: first draft
Date Tue, 14 Jun 2016 16:51:58 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/111#discussion_r67010037
  
    --- Diff: core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java ---
    @@ -262,4 +267,46 @@ public boolean apply(final String input) {
     
       }
     
    +  public static class PortRange extends Matches {
    +
    +    private static final Logger log = LoggerFactory.getLogger(PortRange.class);
    +
    +    public PortRange(final String pattern) {
    +      super(pattern);
    +    }
    +
    +    @Override
    +    public boolean apply(final String input) {
    +      if (super.apply(input)) {
    +        try {
    +          PortRange.parse(input);
    +          return true;
    +        } catch (IllegalArgumentException e) {
    +          return false;
    +        }
    +      } else {
    +        return false;
    +      }
    +    }
    +
    +    public static Pair<Integer,Integer> parse(String portRange) {
    +      int idx = portRange.indexOf('-');
    +      if (idx != -1) {
    +        int low = Integer.parseInt(portRange.substring(0, idx));
    +        if (low < 1024) {
    +          log.error("Invalid port number for low end of the range, using 1024");
    +          low = 1024;
    +        }
    +        int high = Integer.parseInt(portRange.substring(idx + 1));
    +        if (high > 65535) {
    --- End diff --
    
    what about case where `low > 65535`


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