Github user ctubbsii commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/285#discussion_r130346697
--- 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 --
This class plays no role in setting the version of Accumulo, for testing or
otherwise. You set a version by altering the POM, which populates
`Constants.VERSION` during the Maven build. As far as I can tell, the only
function it ever served was to produce surprising errors like the one in the
parent issue by arbitrarily imposing unnecessary restrictions on what the
version string looked like (and now, of course, the `KeywordExecutable` bits
plays the role of providing the implementation for `bin/accumulo version` CLI
command). Anything that's not part of the `KeywordExecutable` bits can be
removed.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---