Repository navigation
Conversation
SqlExecuteNode#executeSqlQuery reads e.getMessage() straight into both the
user-facing streamed text ("SQL执行失败: " + errorMessage) and
SqlRetryDto.sqlExecute(). NPE, StackOverflowError and several JDBC driver
wrappers carry a null message, so the UI rendered the literal
"SQL执行失败: null" and the retry reason stored null.
Fall back to the exception class name when the message is blank, so the
user always sees an actionable reason. The logged stack trace is
unchanged.
Add a regression test that throws a message-less RuntimeException and
asserts no "null" leaks into the streamed text while the failure notice
and retry reason are still produced.
This branch has not been deployed
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 this PR does / why we need it
SqlExecuteNode#executeSqlQueryreadse.getMessage()straight into two places:NullPointerException,StackOverflowErrorand several JDBC driver wrappers carry a null message. In that case the streamed text the user sees becomes the literaland
SqlRetryDto.sqlExecute(null)storesnullas the retry reason. The user gets no actionable information about why their query failed, and the log line is the only place the real cause exists.Root cause
Throwable#getMessage()is nullable by contract, but the value is used unconditionally in user-facing output.log.error("...", sqlQuery, e)is fine with a null message (it only formats into the log line), which is why this only shows up on the UI side.The fix
Fall back to the exception class name when the message is blank:
org.apache.commons.lang3.StringUtilsis already imported in this file.SQL执行失败: java.lang.NullPointerExceptioninstead ofSQL执行失败: null— still terse, but it names the failure class and is what a support/debug conversation needs.How to verify
RED (before the fix)
mvn -o -pl data-agent-management -am -Dtest=SqlExecuteNodeTest -Dsurefire.failIfNoSpecifiedTests=false testThe assertion fires on the exact streamed text the node emits, so the failure is in the production path, not in a stub.
GREEN (after the fix)
Same command →
Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, BUILD SUCCESS.Revert check
Reverting only the
errorMessageline reproduces the single failure; restoring it turns green again.Full module
mvn -o -pl data-agent-management -am -Dspotless.apply.skip=true testThe 6 failures (
PromptHelperTest4,NodeTracingLifecycleListenerTest1,PlannerNodeTest1) are pre-existing on upstreammainand unrelated to this change — isolated by reverting to the upstream versions of the touched files and re-running those three suites (Tests run: 76, Failures: 6). The total went from 1712 to 1713 because this PR adds one test.mvn -o -pl data-agent-management -am -Dspotless.apply.skip=true checkstyle:check→You have 0 Checkstyle violations. BUILD SUCCESS.Special notes for reviews
e.getMessage()-into-user-text pattern exists in ~20 controller catch blocks (e.g.DatasourceController,AgentDatasourceController,AgentKnowledgeController). Those go throughGlobalExceptionHandlerand fixing them all would balloon this into a large cross-cutting PR, so they are deliberately left out of scope. Happy to follow up separately if maintainers want that.onErrorResumeblocks inSqlExecuteNode(chart-config paths) only pass the message tolog.warn, which tolerates null, and never surface it to the user — no change needed there.