Skip to content

[ZEPPELIN-6262] Refactor ElasticsearchClientTypeBuilder for safer enum handling and blank input support#5002

Merged
Reamer merged 2 commits into
apache:masterfrom
ParkGyeongTae:ZEPPELIN-6262
Jul 29, 2025
Merged

[ZEPPELIN-6262] Refactor ElasticsearchClientTypeBuilder for safer enum handling and blank input support#5002
Reamer merged 2 commits into
apache:masterfrom
ParkGyeongTae:ZEPPELIN-6262

Conversation

@ParkGyeongTae

Copy link
Copy Markdown
Member

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

  • - Verify existing tests

What is the Jira issue?

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.

jongyoul
jongyoul previously approved these changes Jul 27, 2025

@jongyoul jongyoul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Reamer Reamer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks better than the previous code, but I still have a few comments.

@Reamer Reamer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Reamer Reamer merged commit 7c08a82 into apache:master Jul 29, 2025
15 of 18 checks passed
asf-gitbox-commits pushed a commit that referenced this pull request Jul 29, 2025
…m 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>
(cherry picked from commit 7c08a82)
Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>
@Reamer

Reamer commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

Merged into master and branch-0.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants