-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix issue #485 : MessagePack queries: Exception during parsing InfluxDB version [macOS] #487
Conversation
Maybe it will be better use some implementation for the Semantic Versioning - semver4j. The method private boolean checkMessagePackSupport() {
Semver version = new Semver(version(), Semver.SemverType.NPM);
return version.isGreaterThan("1.4");
} |
…ing InfluxDB version [macOS]
Codecov Report
@@ Coverage Diff @@
## master #487 +/- ##
============================================
+ Coverage 87.29% 87.35% +0.05%
- Complexity 357 362 +5
============================================
Files 24 24
Lines 1496 1503 +7
Branches 164 167 +3
============================================
+ Hits 1306 1313 +7
Misses 124 124
Partials 66 66
Continue to review full report at Codecov.
|
@bednar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lxhoan I tried the changes on macOS and now the MessagePack queries works
there unit test added for the new version checking, it should cover MacOS case and even unrealistic cases |
@fmachado , please have a look on it, tks |
@lxhoan I know this PR is already merged (and apologies for the delay) but as you requested, I'll add my comments. |
@@ -666,13 +669,26 @@ public boolean databaseExists(final String name) { | |||
public String error; | |||
} | |||
|
|||
private boolean checkMessagePackSupport() { | |||
Matcher matcher = Pattern.compile("(\\d+\\.*)+").matcher(version()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, Pattern.compile
creates an immutable object so you can reuse it. There is another regular expression that would help you so you don't have to split: (?:(\d+)\.)(\d+)
. (you can see it working here). You still have to convert it to int, though.
No description provided.