[ZEPPELIN-6475] Throw clear error for missing InfluxDB token#5301
Open
gyowoo1113 wants to merge 2 commits into
Open
[ZEPPELIN-6475] Throw clear error for missing InfluxDB token#5301gyowoo1113 wants to merge 2 commits into
gyowoo1113 wants to merge 2 commits into
Conversation
hyunw9
reviewed
Jul 14, 2026
|
|
||
| if (this.client == null) { | ||
| String token = getProperty(INFLUXDB_TOKEN_PROPERTY); | ||
| if (token == null || token.trim().isEmpty()) { |
Contributor
There was a problem hiding this comment.
nit :
How about token.isBlank() instead? it covers same situations but it reads more clearly.
Author
There was a problem hiding this comment.
Good point, thanks! I’ve updated it to use isBlank().
jongyoul
previously approved these changes
Jul 15, 2026
ParkGyeongTae
approved these changes
Jul 15, 2026
Member
There was a problem hiding this comment.
Thanks for fixing this, @gyowoo1113! I pulled the branch and verified locally:
- Confirmed the NPE reproduces on master when influxdb.token is unset (getProperty(...).toCharArray() on a null value).
- The open() signature change to throws InterpreterException is safe — the parent Interpreter.open() already declares throws InterpreterException, so no callers are affected.
- String.isBlank() is fine here since the project targets Java 11.
- Ran ./mvnw test -pl influxdb -Dtest=InfluxDBInterpeterTest: all 5 tests pass (2 existing + 3 new for missing/empty/blank token).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
InfluxDBInterpreter.open()read theinfluxdb.tokenproperty and immediately calledtoCharArray()on the returned value. When the token was not configured,getProperty(...)returnednull, causing aNullPointerExceptionwithout explaining that the authentication token was missing.This PR validates the token before building the InfluxDB client. Missing, empty, and blank token values now throw an
InterpreterExceptionwith a clear configuration message instead of aNullPointerException.Unit tests were added for absent, empty, and whitespace-only token values. Other InfluxDB properties and client creation behavior are unchanged.
What type of PR is it?
Bug Fix
Todos
influxdb.tokenvaluesInterpreterExceptionwith a clear error messageWhat is the Jira issue?
ZEPPELIN-6475
How should this be tested?
./mvnw test -pl influxdbpasses successfully.To run only the interpreter test:
./mvnw test -pl influxdb -Dtest=InfluxDBInterpeterTestpasses successfully.Missing, empty, and blank
influxdb.tokenvalues throwInterpreterExceptioninstead ofNullPointerException.Screenshots (if appropriate)
N/A
Questions: