Skip to content

CAMEL-23279: fix SamplingDefinition.description() NumberFormatException with property placeholders#22440

Open
Croway wants to merge 1 commit intoapache:mainfrom
Croway:ci-issue-CAMEL-23279
Open

CAMEL-23279: fix SamplingDefinition.description() NumberFormatException with property placeholders#22440
Croway wants to merge 1 commit intoapache:mainfrom
Croway:ci-issue-CAMEL-23279

Conversation

@Croway
Copy link
Copy Markdown
Contributor

@Croway Croway commented Apr 3, 2026

Summary

  • SamplingDefinition.description() calls TimeUtils.toDuration(samplePeriod) before property placeholders are resolved, causing NumberFormatException when using {{sample.period}}
  • Changed to return the raw string value instead, consistent with how ThrottleDefinition.description() handles timePeriodMillis
  • Added test for property placeholder usage with sample()

Test plan

  • SamplingThrottlerTest#testSamplingWithPropertyPlaceholder — verifies route starts with {{sample.period}} placeholder
  • All existing SamplingThrottlerTest tests pass (6/6)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🌟 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 build-all, build-dependents, 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.

…on with property placeholders

Avoid premature parsing of samplePeriod through TimeUtils.toDuration()
in description(), which fails when the value contains unresolved
property placeholders like {{sample.period}}. Return the raw string
value instead, consistent with ThrottleDefinition.description().
@Croway Croway force-pushed the ci-issue-CAMEL-23279 branch from a8bfdb8 to 61034a5 Compare April 3, 2026 14:52
@Croway Croway requested a review from davsclaus April 3, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant