Skip to content

Throw actionable errors for invalid RdbmsTypeEnum config values - #3205

Open
terryozaki-wq wants to merge 1 commit into
devfrom
rdbms-type-enum-actionable-errors
Open

terryozaki-wq wants to merge 1 commit into
devfrom
rdbms-type-enum-actionable-errors

Conversation

@terryozaki-wq

Copy link
Copy Markdown

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 JDK IllegalArgumentException, which names only the bad value with no guidance.
  • Adds 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.
  • Applies it at every call site: InsightsRDBMSUtils (both generateInsightsDatabase overloads), ProjectHelper.loadInsightsEngine, and SmssUtilities (getInsightsRdbmsFile, createTemporaryProjectSmss, createTemporaryAssetSmss, generateInsightsDatabase).
  • FrameFactory's DEFAULT_GRID_TYPE parsing already wraps valueOf() in a try/catch with a logged fallback, so it's left alone.

Test plan

  • New unit tests across RdbmsTypeEnumUnitTests, ProjectHelperUnitTests, InsightsRDBMSUtilsUnitTests, and 4 new methods in SmssUtilitiesUnitTests — 17/17 passing.
  • Full mvn test-compile — BUILD SUCCESS.

🤖 Generated with Claude Code

…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>
@terryozaki-wq
terryozaki-wq requested a review from a team as a code owner October 26, 2026 16:43
@snyk-io

snyk-io Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

1 participant