Skip to content

Expose UncPath for backward compatibility #17862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

Croway
Copy link
Contributor

@Croway Croway commented Apr 24, 2025

The previous smb implementation was providing more information wrt the absolute path, for example, if camel-smb is connected to a share localhost/data-rw, and files are created under data-rw, a Camel consumer absolute path would be /fileName without data-rw, and there is no way to retrieve that information from the GenericFile, the previous implementation was handing smbj.File and that information was there.

Does it make sense to add a header with that information?

@Croway Croway requested review from davsclaus and orpiske April 24, 2025 12:04
Copy link
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.

  • 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.

@davsclaus
Copy link
Contributor

Can you do this in all the retrieveFile methods to set that header

Copy link
Contributor

@orpiske orpiske left a comment

Choose a reason for hiding this comment

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

Thanks!!!

@davsclaus
Copy link
Contributor

[ERROR] org.apache.camel.component.smb.SmbComponentIT.testSmbRead -- Time elapsed: 2.028 s <<< FAILURE!
java.lang.AssertionError: mock://result Expected 1 headers with key[CamelSmbUncPath], received 0 headers. Expected header values: [\localhost\data-rw\1.txt]
at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:2015)
at org.apache.camel.component.mock.MockEndpoint.assertTrue(MockEndpoint.java:1986)
at org.apache.camel.component.mock.MockEndpoint.lambda$expectedHeaderValuesReceivedInAnyOrder$0(MockEndpoint.java:691)
at org.apache.camel.component.mock.MockEndpoint.runTests(MockEndpoint.java:488)
at org.apache.camel.component.mock.MockEndpoint.doAssertIsSatisfied(MockEndpoint.java:469)
at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:431)
at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:421)
at org.apache.camel.component.smb.SmbComponentIT.testSmbRead(SmbComponentIT.java:53)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

@Croway
Copy link
Contributor Author

Croway commented Apr 24, 2025

[ERROR] org.apache.camel.component.smb.SmbComponentIT.testSmbRead -- Time elapsed: 2.028 s <<< FAILURE! java.lang.AssertionError: mock://result Expected 1 headers with key[CamelSmbUncPath], received 0 headers. Expected header values: [\localhost\data-rw\1.txt] at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:2015) at org.apache.camel.component.mock.MockEndpoint.assertTrue(MockEndpoint.java:1986) at org.apache.camel.component.mock.MockEndpoint.lambda$expectedHeaderValuesReceivedInAnyOrder$0(MockEndpoint.java:691) at org.apache.camel.component.mock.MockEndpoint.runTests(MockEndpoint.java:488) at org.apache.camel.component.mock.MockEndpoint.doAssertIsSatisfied(MockEndpoint.java:469) at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:431) at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:421) at org.apache.camel.component.smb.SmbComponentIT.testSmbRead(SmbComponentIT.java:53) at java.base/java.lang.reflect.Method.invoke(Method.java:569) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

yeah, that is strange, locally is working, this line of code https://github.com/apache/camel/pull/17862/files#diff-c8ac41955f06eb913c93ab390020b89defda37d45def4e970d1fd9aeae4601d4R244 is supposed to add that header

@davsclaus davsclaus force-pushed the expose-smb-unc-path branch from 346ebc9 to 9e39b6c Compare April 24, 2025 17:31
@davsclaus
Copy link
Contributor

yeah its strange

@davsclaus
Copy link
Contributor

Maybe you can add some logging in that code to see what the CI server logs - its hard to reproduce this if it works locally but fails on ASF CI only.

@davsclaus davsclaus force-pushed the expose-smb-unc-path branch from 9e39b6c to 7fbcf84 Compare April 24, 2025 20:01
@davsclaus
Copy link
Contributor

okay I have a fix in the works

@davsclaus
Copy link
Contributor

okay fixed and merged in another commit

@davsclaus davsclaus closed this Apr 25, 2025
@Croway
Copy link
Contributor Author

Croway commented Apr 25, 2025

okay fixed and merged in another commit

Thanks a lot Claus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants