Skip to content

fix(QTDI-2912): fix Possible ClassCastException in SchemaConverter#1231

Open
undx wants to merge 3 commits into
masterfrom
ouf/QTDI-2912-Possible-ClassCastException-in-SchemaConverter
Open

fix(QTDI-2912): fix Possible ClassCastException in SchemaConverter#1231
undx wants to merge 3 commits into
masterfrom
ouf/QTDI-2912-Possible-ClassCastException-in-SchemaConverter

Conversation

@undx
Copy link
Copy Markdown
Member

@undx undx commented May 28, 2026

https://qlik-dev.atlassian.net/browse/QTDI-2912

Requirements

  • Any code change adding any logic MUST be tested through a unit test executed with the default build
  • Any API addition MUST be done with a documentation update if relevant

Why this PR is needed?

What does this PR adds (design/code thoughts)?

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a numeric-conversion bug in SchemaConverter that could throw a ClassCastException when converting Float default values to JSON, and adds unit tests to prevent regressions in numeric handling.

Changes:

  • Reworked SchemaConverter#toValue numeric handling to avoid casting Float to Double and added a Number fallback.
  • Added SchemaConverterTest regression tests for Float/Double and other numeric types, including BigDecimal/BigInteger precision checks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
component-runtime-manager/src/main/java/org/talend/sdk/component/runtime/manager/xbean/converter/SchemaConverter.java Adjusts numeric branches in toValue() to prevent Float casting failures and adds a Number fallback.
component-runtime-manager/src/test/java/org/talend/sdk/component/runtime/manager/xbean/converter/SchemaConverterTest.java Adds regression/unit tests covering numeric conversion behavior for toValue().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@sonar-rnd
Copy link
Copy Markdown

sonar-rnd Bot commented May 28, 2026

Failed Quality Gate failed

  • 0.00% Coverage on New Code (is less than 80.00%)

Project ID: org.talend.sdk.component:component-runtime

View in SonarQube

@undx undx requested a review from ozhelezniak-talend May 28, 2026 11:22
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.

2 participants