Skip to content

Commit

Permalink
[KYUUBI #6291] Avoid NPE in MySQLErrPacket
Browse files Browse the repository at this point in the history
# 🔍 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]>
  • Loading branch information
2 people authored and pan3793 committed Apr 11, 2024
1 parent 7db47f1 commit 7d93267
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7d93267

Please sign in to comment.