Commit e52480a
committed
Fix NPE in SimpleDataSourceProperties when driver is null
- Prevent NullPointerException in SimpleDataSourceProperties by adding null check before calling getDriver().getClass().
- Fixes potential crash when driver is not explicitly configured.
- Add null checks in convertToString method to handle null Class values
- Add test case to verify NPE-free operation when deriving DataSource
Signed-off-by: chanbinme <[email protected]>1 parent 1ae0548 commit e52480a
File tree
2 files changed
+18
-1
lines changed- spring-boot-project/spring-boot/src
- main/java/org/springframework/boot/jdbc
- test/java/org/springframework/boot/jdbc
2 files changed
+18
-1
lines changedspring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DataSourceBuilder.java
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
508 | 508 | | |
509 | 509 | | |
510 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
511 | 514 | | |
512 | 515 | | |
513 | 516 | | |
| |||
712 | 715 | | |
713 | 716 | | |
714 | 717 | | |
715 | | - | |
| 718 | + | |
| 719 | + | |
716 | 720 | | |
717 | 721 | | |
718 | 722 | | |
| |||
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
| 57 | + | |
| 58 | + | |
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| |||
522 | 525 | | |
523 | 526 | | |
524 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
525 | 538 | | |
526 | 539 | | |
527 | 540 | | |
| |||
0 commit comments