accumulo-dev mailing list archives

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

    https://github.com/apache/accumulo/pull/285#discussion_r130330269
  
    --- 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 --
    
    Can probably also delete this constructor, the `toString()` method, and `this.version`,
as well as the entire `TestVersion.java`.
    
    Other than the `KeywordExecutable` stuff (to support printing the version from the command-line),
this class seems to only be used in one place (server/base/src/main/java/org/apache/accumulo/server/Accumulo.java),
and only as an unnecessary wrapper around `Constants.VERSION` for a RuntimeException message.


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