This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.9 by this push:
new 7d9326772 [KYUUBI #6291] Avoid NPE in MySQLErrPacket
7d9326772 is described below
commit 7d93267727aa963783a79845e00c1f8fbc2cc369
Author: hezhao2 <[email protected]>
AuthorDate: Thu Apr 11 19:02:48 2024 +0800
[KYUUBI #6291] Avoid NPE in MySQLErrPacket
# :mag: Description
as title
## Issue References ๐
This pull request fixes #6291
## Describe Your Solution ๐ง
Add a rule to check if it's null
## Types of changes :bookmark:
- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
## Test Plan ๐งช
#### Behavior Without This Pull Request :coffin:
#### Behavior With This Pull Request :tada:
#### Related Unit Tests
---
# Checklist ๐
- [x] This patch was not authored or co-authored using [Generative
Tooling](https://www.apache.org/legal/generative-tooling.html)
**Be nice. Be informative.**
Closes #6292 from zhaohehuhu/dev-0411.
Closes #6291
a58eed609 [hezhao2] refactor
40ad5e0fa [hezhao2] Avoid NPE in MySQLErrPacket
e02be17b4 [dupeng] [KYUUBI #6288] [KYUUBI #6283] Improve the message of
distribution built without enabling web ui
Lead-authored-by: hezhao2 <[email protected]>
Co-authored-by: dupeng <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit f43cc593c3bb67ba6f678ce32ba74da0aa7c4f56)
Signed-off-by: Cheng Pan <[email protected]>
---
.../scala/org/apache/kyuubi/server/mysql/MySQLGenericPackets.scala | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLGenericPackets.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLGenericPackets.scala
index f378bc0a0..946e9c313 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLGenericPackets.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLGenericPackets.scala
@@ -54,7 +54,8 @@ object MySQLErrPacket {
case kse: KyuubiSQLException if kse.getCause != null =>
// prefer brief nested error message instead of whole stacktrace
apply(kse.getCause)
- case e: Exception if e.getMessage contains "NoSuchDatabaseException" =>
+ case e: Exception
+ if e.getMessage != null &&
e.getMessage.contains("NoSuchDatabaseException") =>
MySQLErrPacket(1, MySQLErrorCode.ER_BAD_DB_ERROR, cause.getMessage)
case se: SQLException if se.getSQLState == null =>
MySQLErrPacket(1, MySQLErrorCode.ER_INTERNAL_ERROR, cause.getMessage)