CAMEL-24123: camel-smb - Fix readLock=changed with recursive=true#24789
Conversation
…er consuming sub-directory files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet
left a comment
There was a problem hiding this comment.
Clean 1-line fix — the bug is obvious once spotted, and the code itself already proves the correct method.
The bug: getSmbFiles() passes file.getFileName() (relative path, e.g. sub/hello.txt for recursive consumers) as the SMB QueryDirectory search pattern. SMB search patterns are plain names/wildcards within a directory — a pattern with path separators matches nothing, so share.list(path, "sub/hello.txt") returns an empty array, newLength=0, and isReadLockAcquired() never succeeds.
The proof is in the same method: At line 59, the match logic already uses file.getFileNameOnly():
boolean match = f.getFileName().equals(file.getFileNameOnly());This confirms the search pattern should also be getFileNameOnly() — the listing and the matching must agree on the name format.
Fix: Change file.getFileName() → file.getFileNameOnly() in the listFiles() call. The parent directory is already correctly extracted via file.getParent().
Checklist:
- ✅ 1-line fix, obviously correct
- ✅ Consistent with the match at line 59
- ✅ No new test, but the fix is self-evidently correct from the surrounding code
- ✅ CI pending (builds running)
Reviewed with Claude Code (claude-code/1.0) on behalf of gnodet. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 9 tested, 29 compile-only — current: 9 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 9).
|
Claude Code on behalf of davsclaus
Summary
readLock=changedwithrecursive=truenever consuming files in sub-directoriesSmbExclusiveReadLockCheck.getSmbFiles()was passingfile.getFileName()(relative path, e.g.sub/hello.txt) as the SMB search pattern instead offile.getFileNameOnly()(plain name, e.g.hello.txt)newLength=0 < minLengthand the read lock was never acquiredTest plan
cd components/camel-smb && mvn install -DskipTestscd components/camel-smb && mvn testrecursive=trueandreadLock=changedthat files in sub-directories are consumed🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com