Repository navigation
Throw actionable errors for invalid RdbmsTypeEnum config values - #3205
Open
terryozaki-wq wants to merge 1 commit into
Open
terryozaki-wq wants to merge 1 commit into
terryozaki-wq wants to merge 1 commit into
Conversation
…values RdbmsTypeEnum.valueOf() was called directly on config/property-sourced strings (DEFAULT_INSIGHTS_RDBMS, RDBMS_INSIGHTS_TYPE) with no case/whitespace normalization and no handling around the default JDK IllegalArgumentException, which names only the bad value with no guidance. Add RdbmsTypeEnum.getEnumFromStringOrThrow(), which normalizes via the existing getEnumFromString() and throws a clear exception listing all valid values when it still can't resolve a match. Apply it at every call site: InsightsRDBMSUtils (both generateInsightsDatabase overloads), ProjectHelper.loadInsightsEngine, and SmssUtilities (getInsightsRdbmsFile, createTemporaryProjectSmss, createTemporaryAssetSmss, generateInsightsDatabase). Add unit tests covering the invalid-value case for each. AuditDatabase.java, one of the original call sites for this fix on a downstream fork, no longer exists on dev (superseded by #3172's SQL write auditing rework), so that part of the fix doesn't apply here. FrameFactory's DEFAULT_GRID_TYPE parsing already wraps valueOf() in a try/catch with a logged fallback, so it's left alone. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
Summary
RdbmsTypeEnum.valueOf()was called directly on config/property-sourced strings (DEFAULT_INSIGHTS_RDBMS,RDBMS_INSIGHTS_TYPE) with no case/whitespace normalization and no handling around the default JDKIllegalArgumentException, which names only the bad value with no guidance.RdbmsTypeEnum.getEnumFromStringOrThrow(), which normalizes via the existinggetEnumFromString()and throws a clear exception listing all valid values when it still can't resolve a match.InsightsRDBMSUtils(bothgenerateInsightsDatabaseoverloads),ProjectHelper.loadInsightsEngine, andSmssUtilities(getInsightsRdbmsFile,createTemporaryProjectSmss,createTemporaryAssetSmss,generateInsightsDatabase).FrameFactory'sDEFAULT_GRID_TYPEparsing already wrapsvalueOf()in a try/catch with a logged fallback, so it's left alone.Test plan
RdbmsTypeEnumUnitTests,ProjectHelperUnitTests,InsightsRDBMSUtilsUnitTests, and 4 new methods inSmssUtilitiesUnitTests— 17/17 passing.mvn test-compile—BUILD SUCCESS.🤖 Generated with Claude Code