Skip to content

CAMEL-24348: camel-google-bigquery - report unusable bodies and missing jobs properly - #25448

Merged
davsclaus merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-24348
Aug 12, 2026
Merged

CAMEL-24348: camel-google-bigquery - report unusable bodies and missing jobs properly#25448
davsclaus merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-24348

Conversation

@oscerd

@oscerd oscerd commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Three NPE/exception-hygiene fixes.

1. A message with no body failed with a NullPointerException. The producer built its error out
of the body's class:

ex.setException(new IllegalArgumentException("Cannot handle body type " + entryObject.getClass()));

so the branch meant to report an unusable body threw while reporting it. It now says
Cannot handle body type null.

2. An unknown CamelGoogleBigQueryJobId gave a NullPointerException. In the SQL producer both
bigquery.getJob(jobId) and job.waitFor() return null for a job that no longer exists (expired,
or never created), and neither was checked before use. Both now fail with a message naming the job.

3. Three raw throw new Exception(...) in GoogleBigQueryProducer and GoogleBigQuerySQLProducer
are now RuntimeCamelException, so routes get a Camel exception. onException(Exception.class)
still matches, since RuntimeCamelException is one.

Withdrawn from the issue description: the audit also claimed the CamelGoogleBigQueryInsertId
header is wrongly ignored for List bodies. Applying it there would be a bug: BigQuery uses the
insert id for best-effort deduplication, so giving every row of a list the same id makes it keep one
row and drop the rest. The existing behaviour is right — useAsInsertId (a field name, so one id per
row) is the option for list payloads. This PR only adds a comment recording that, and I commented on
the JIRA issue.

Claude Code on behalf of oscerd

🤖 Generated with Claude Code

…ng jobs properly

A message with no body failed with a NullPointerException while building the
"Cannot handle body type" message, instead of reporting that there was no body.

In the SQL producer a CamelGoogleBigQueryJobId that no longer resolves gave a
NullPointerException as well: both getJob and waitFor return null for a job that
does not exist any more, and neither was checked.

The three raw java.lang.Exception throws in the two producers are now
RuntimeCamelException, so routes see a Camel exception rather than a bare one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd oscerd added the bug Something isn't working label Aug 11, 2026
@oscerd
oscerd requested review from Croway and davsclaus August 11, 2026 18:16
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-google/camel-google-bigquery

🔬 Scalpel shadow comparison — Scalpel: 9 tested, 29 compile-only — current: 9 all tested

Maveniverse Scalpel detected 38 affected modules (current approach: 9).

⚠️ Modules only in Scalpel (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 9 modules (1 direct + 8 downstream), skip tests for 29 (generated code, meta-modules)

Modules Scalpel would test (9)
  • camel-google-bigquery
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (38 modules)
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Google :: BigQuery
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus left a comment

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.

Looks good — three well-scoped fixes for real NPE/exception-hygiene issues.

What's good:

  • Null-body guard in GoogleBigQueryProducer correctly reports instead of crashing, and the loop + apiRequestRows.isEmpty() handle it gracefully
  • Null checks on getJob() / waitFor() in GoogleBigQuerySQLProducer cover the realistic failure paths with descriptive messages
  • RuntimeCamelException is the right Camel exception type — propagates cleanly through the routing engine
  • The insert-ID comment in the List branch is a useful "why" note that prevents someone from re-introducing the dedup bug
  • New test class follows conventions: AssertJ, package-private, covers both null and non-map/list body cases

Minor observations (non-blocking):

  • No unit tests for the SQL producer null-job handling — understandable given the mocking complexity, worth noting as a future improvement

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

@davsclaus davsclaus added this to the 4.23.0 milestone Aug 12, 2026
@davsclaus
davsclaus merged commit b9266ce into apache:main Aug 12, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants