You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/11/07 02:08:52 UTC
[iotdb] branch master updated: [IOTDB-985] Unclear message when
password is wrong (#1973)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new cce61a2 [IOTDB-985] Unclear message when password is wrong (#1973)
cce61a2 is described below
commit cce61a2bfbbe8f0a863140d7f395d530ad0db7fa
Author: Steve Yurong Su <st...@outlook.com>
AuthorDate: Sat Nov 7 10:08:33 2020 +0800
[IOTDB-985] Unclear message when password is wrong (#1973)
* let the server return a clear message when the login authentication fails
---
cli/src/main/java/org/apache/iotdb/cli/Cli.java | 4 +---
cli/src/main/java/org/apache/iotdb/cli/WinCli.java | 3 +--
.../src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java | 7 +++----
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/cli/src/main/java/org/apache/iotdb/cli/Cli.java b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
index dc0e967..ba877ee 100644
--- a/cli/src/main/java/org/apache/iotdb/cli/Cli.java
+++ b/cli/src/main/java/org/apache/iotdb/cli/Cli.java
@@ -159,9 +159,7 @@ public class Cli extends AbstractCli {
}
} catch (SQLException e) {
println(String
- .format("%s> %s Host is %s, port is %s.", IOTDB_CLI_PREFIX, e.getMessage(), host,
- port));
+ .format("%s> %s Host is %s, port is %s.", IOTDB_CLI_PREFIX, e.getMessage(), host, port));
}
}
-
}
diff --git a/cli/src/main/java/org/apache/iotdb/cli/WinCli.java b/cli/src/main/java/org/apache/iotdb/cli/WinCli.java
index 121d912..cc956d1 100644
--- a/cli/src/main/java/org/apache/iotdb/cli/WinCli.java
+++ b/cli/src/main/java/org/apache/iotdb/cli/WinCli.java
@@ -164,8 +164,7 @@ public class WinCli extends AbstractCli {
}
} catch (SQLException e) {
println(String
- .format("%s> %s Host is %s, port is %s.", IOTDB_CLI_PREFIX, e.getMessage(), host,
- port));
+ .format("%s> %s Host is %s, port is %s.", IOTDB_CLI_PREFIX, e.getMessage(), host, port));
}
}
}
diff --git a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 67fceec..67372c6 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -235,8 +235,7 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
if (!compatible) {
tsStatus = RpcUtils.getStatus(TSStatusCode.INCOMPATIBLE_VERSION,
"The version is incompatible, please upgrade to " + IoTDBConstant.VERSION);
- TSOpenSessionResp resp = new TSOpenSessionResp(tsStatus,
- CURRENT_RPC_VERSION);
+ TSOpenSessionResp resp = new TSOpenSessionResp(tsStatus, CURRENT_RPC_VERSION);
resp.setSessionId(sessionId);
return resp;
}
@@ -247,8 +246,8 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
sessionIdZoneIdMap.put(sessionId, ZoneId.of(req.getZoneId()));
currSessionId.set(sessionId);
} else {
- tsStatus = RpcUtils.getStatus(TSStatusCode.WRONG_LOGIN_PASSWORD_ERROR);
- tsStatus.setMessage(loginMessage);
+ tsStatus = RpcUtils.getStatus(TSStatusCode.WRONG_LOGIN_PASSWORD_ERROR,
+ loginMessage != null ? loginMessage : "Authentication failed.");
}
auditLogger.info("User {} opens Session-{}", req.getUsername(), sessionId);
TSOpenSessionResp resp = new TSOpenSessionResp(tsStatus,