imbajin commented on code in PR #685:
URL:
https://github.com/apache/incubator-hugegraph-toolchain/pull/685#discussion_r2464736456
##########
hugegraph-client/src/main/java/org/apache/hugegraph/driver/HugeClient.java:
##########
@@ -173,18 +173,10 @@ private void checkServerApiVersion() {
// 0.81 equals to the {latest_api_version} +10
VersionUtil.check(apiVersion, "0.38", "0.81", "hugegraph-api in
server");
this.client.apiVersion(apiVersion);
- boolean supportGs = VersionUtil.gte(this.version.getCoreVersion(),
"2.0");
+ boolean supportGs = VersionUtil.gte(this.version.getCoreVersion(),
"1.7.0");
Review Comment:
⚠️ **逻辑不一致问题 (Medium)**
这行代码与 RestClient.java:54 的逻辑重复了:
- RestClient.java:54: `supportGs = VersionUtil.gte(version, "1.7.0")`
- HugeClient.java:176: `supportGs =
VersionUtil.gte(this.version.getCoreVersion(), "1.7.0")`
**存在的问题:**
1. 版本检查逻辑重复
2. 可能导致两处判断结果不一致(虽然当前不太可能)
3. 违反 DRY 原则
**建议:**
删除此行,因为 RestClient 已经在初始化时设置了 `supportGs`。或者反过来,只在 HugeClient
中设置一次,RestClient 不要在字段初始化时就调用网络请求。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]