accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From glitch <...@git.apache.org>
Subject [GitHub] accumulo pull request #285: Fixes ACCUMULO-4555 treat Version as a simple st...
Date Mon, 31 Jul 2017 12:24:12 GMT
Github user glitch commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/285#discussion_r130338251
  
    --- Diff: core/src/main/java/org/apache/accumulo/core/util/Version.java ---
    @@ -53,74 +56,13 @@ public void execute(final String[] args) throws Exception {
         System.out.println(runTMP.getField("VERSION").get(null));
       }
     
    -  String package_ = null;
    -  int major = 0;
    -  int minor = 0;
    -  int release = 0;
    -  String etcetera = null;
    -
    -  public Version(String everything) {
    -    parse(everything);
    -  }
    -
    -  private void parse(String everything) {
    -    Pattern pattern = Pattern.compile("(([^-]*)-)?(\\d+)(\\.(\\d+)(\\.(\\d+))?)?(-(.*))?");
    -    Matcher parser = pattern.matcher(everything);
    -    if (!parser.matches()) {
    -      log.warn("Unable to parse '{}' as a version", everything);
    -      return;
    -    }
    -
    -    if (parser.group(1) != null)
    -      package_ = parser.group(2);
    -    major = Integer.parseInt(parser.group(3));
    -    minor = 0;
    -    if (parser.group(5) != null)
    -      minor = Integer.parseInt(parser.group(5));
    -    if (parser.group(7) != null)
    -      release = Integer.parseInt(parser.group(7));
    -    if (parser.group(9) != null)
    -      etcetera = parser.group(9);
    -
    -  }
    -
    -  public String getPackage() {
    -    return package_;
    -  }
    -
    -  public int getMajorVersion() {
    -    return major;
    -  }
    -
    -  public int getMinorVersion() {
    -    return minor;
    -  }
    -
    -  public int getReleaseVersion() {
    -    return release;
    -  }
    -
    -  public String getEtcetera() {
    -    return etcetera;
    +  public Version(String version) {
    --- End diff --
    
    The parent ticket ACCUMULO-4554 stated that you might want the ability to set the version
for testing and setting it to a non-matching format caused IllegalArgumentException to be
thrown. That's why I retained the ability to set an arbitrary version through the constructor.


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