Skip to content

Commit 3930d14

Browse files
zhaohehuhudupen01
authored andcommitted
[KYUUBI #6291] Avoid NPE in MySQLErrPacket
# 🔍 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 🔖 - [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 ⚰️ #### Behavior With This Pull Request 🎉 #### 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 a58eed6 [hezhao2] refactor 40ad5e0 [hezhao2] Avoid NPE in MySQLErrPacket e02be17 [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 f43cc59) Signed-off-by: Cheng Pan <[email protected]>
1 parent a0abf3f commit 3930d14

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLGenericPackets.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ object MySQLErrPacket {
5454
case kse: KyuubiSQLException if kse.getCause != null =>
5555
// prefer brief nested error message instead of whole stacktrace
5656
apply(kse.getCause)
57-
case e: Exception if e.getMessage contains "NoSuchDatabaseException" =>
57+
case e: Exception
58+
if e.getMessage != null && e.getMessage.contains("NoSuchDatabaseException") =>
5859
MySQLErrPacket(1, MySQLErrorCode.ER_BAD_DB_ERROR, cause.getMessage)
5960
case se: SQLException if se.getSQLState == null =>
6061
MySQLErrPacket(1, MySQLErrorCode.ER_INTERNAL_ERROR, cause.getMessage)

0 commit comments

Comments
 (0)