Skip to content

[CALCITE-6284] Invalid conversion triggers ClassCastException - #5188

Open
xuzifu666 wants to merge 6 commits into
apache:mainfrom
xuzifu666:calcite-6284
Open

[CALCITE-6284] Invalid conversion triggers ClassCastException#5188
xuzifu666 wants to merge 6 commits into
apache:mainfrom
xuzifu666:calcite-6284

Conversation

@xuzifu666

Copy link
Copy Markdown
Member

/** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-6284">[CALCITE-6284]
* Invalid conversion triggers ClassCastException</a>. */
@Test void bindStringParameter() {

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.

The bug report is about the message produced when the conversion FAILS.
What happens if you pass a non-numeric string?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. The original test only covered the success path. I added bindInvalidStringParameter() and improved the error message:
Before: NumberFormatException with null message.
After: NumberFormatException: Invalid value for BigDecimal: "abc".

@sonarqubecloud

Copy link
Copy Markdown

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