Commit 7c08a82
authored
[ZEPPELIN-6262] Refactor ElasticsearchClientTypeBuilder for safer enum handling and blank input support
### What is this PR for?
This PR refactors the ElasticsearchClientTypeBuilder class to improve its robustness and readability:
- Replaces StringUtils.isEmpty() with StringUtils.isBlank() to treat whitespace-only strings as invalid input
- Simplifies enum parsing by removing redundant checks and using a try-catch block around Enum.valueOf(...)
- Ensures that invalid or null inputs gracefully fall back to ElasticsearchClientType.UNKNOWN
### What type of PR is it?
Refactoring
### Todos
* [x] - Verify existing tests
### What is the Jira issue?
* Jira: https://issues.apache.org/jira/browse/ZEPPELIN-6262
### How should this be tested?
N/A
### Screenshots (if appropriate)
N/A
### Questions:
* Does the license files need to update? No.
* Is there breaking changes for older versions? No.
* Does this needs documentation? No.
Closes #5002 from ParkGyeongTae/ZEPPELIN-6262.
Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>1 parent 91a8565 commit 7c08a82
1 file changed
Lines changed: 8 additions & 13 deletions
File tree
- elasticsearch/src/main/java/org/apache/zeppelin/elasticsearch/client
Lines changed: 8 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | 22 | | |
25 | 23 | | |
26 | | - | |
27 | | - | |
28 | 24 | | |
29 | 25 | | |
30 | 26 | | |
| |||
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
54 | 49 | | |
55 | 50 | | |
56 | 51 | | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
62 | 57 | | |
63 | 58 | | |
64 | 59 | | |
0 commit comments