Skip to content

CAMEL-24159: camel-azure-storage-datalake - Fix medium-severity bugs from code review#24871

Merged
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-24159-datalake
Jul 17, 2026
Merged

CAMEL-24159: camel-azure-storage-datalake - Fix medium-severity bugs from code review#24871
davsclaus merged 1 commit into
mainfrom
fix/CAMEL-24159-datalake

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

Claude Code on behalf of davsclaus

Fixes 4 medium-severity findings in camel-azure-storage-datalake from CAMEL-24159 code review:

  • Credential override guard (DataLakeComponent): wrap the auto-detection else branch with if (credentialType == null) so user-explicit credential type is not overridden when credential objects are found in the configuration.
  • Duplicate setRequestConditions (DataLakeFileOperations.upload()): remove the duplicate .setRequestConditions() call on FileParallelUploadOptions (copy-paste error).
  • Null position NPE (DataLakeFileOperations.flushToFile()): guard against null position (which is Long with no default) before unboxing arithmetic with fileClientWrapper.getFileSize(). Defaults to 0 when null.
  • Consumer downloadToFile failures (DataLakeFileOperations.downloadToFile()): create parent directories before downloading (fixes NoSuchFileException for nested file names like dir/file.txt) and delete existing file first (fixes FileAlreadyExistsException on re-poll).

Test plan

  • Module builds successfully: cd components/camel-azure/camel-azure-storage-datalake && mvn clean install
  • Verify credential override guard preserves user-explicit credentialType
  • Verify upload operation with request conditions succeeds (no duplicate setter)
  • Verify flushToFile with null position doesn't throw NPE
  • Verify consumer re-poll downloads successfully without FileAlreadyExistsException

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

…from code review

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
@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.

@gnodet gnodet 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.

Claude Code on behalf of gnodet

Four clean fixes, all consistent with the patterns established across the azure PR series. This completes PR 5 of 5 for CAMEL-24159.

1. Credential override guard (DataLakeComponent.java)

The if (credentialType == null) guard wraps the entire auto-detection cascade (shared key → SAS → client secret), preventing any of it from running when the user explicitly set credentialType. Correct. ✅

2. Duplicate setRequestConditions (DataLakeFileOperations.java — upload)

Classic copy-paste error — .setRequestConditions() was called twice in the builder chain with the same argument. The second call silently overwrote the first. Removing the duplicate is correct. ✅

3. Null position NPE (DataLakeFileOperations.java — flushToFile)

position is Long (boxed). The expression position + fileClientWrapper.getFileSize() auto-unboxes, which NPEs when position is null. The ternary (position != null ? position : 0L) defaults to offset 0, which is the correct semantic — flush from the start of the appended data. ✅

4. Consumer downloadToFile — parent dirs + existing file

Same pattern as the blob PR (#24869): parentDir.mkdirs() for nested file names, delete() before re-download to prevent FileAlreadyExistsException on re-poll. ✅

LGTM ✅

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-azure/camel-azure-storage-datalake

🔬 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-azure-storage-datalake
  • 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 :: Azure :: Storage Datalake
  • 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 :: 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 added this to the 4.22.0 milestone Jul 17, 2026
@davsclaus davsclaus added the bug Something isn't working label Jul 17, 2026
@davsclaus davsclaus self-assigned this Jul 17, 2026
@davsclaus
davsclaus merged commit f6ae9ec into main Jul 17, 2026
5 checks passed
@davsclaus
davsclaus deleted the fix/CAMEL-24159-datalake branch July 17, 2026 20:42
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.

2 participants