Dhairya-007 opened a new pull request, #29964:
URL: https://github.com/apache/camel/pull/29964
## Problem
`FileConstants` documents the header as a `File`:
```java
@Metadata(label = "producer", description = "The local work path", javaType
= "File")
public static final String FILE_LOCAL_WORK_PATH =
Exchange.FILE_LOCAL_WORK_PATH;
```
Nothing ever puts a `File` in it. Every component that sets it sets the path
string - `FtpOperations`, `SftpOperations`, `MinaSftpOperations`,
`FilesOperations` and `SmbOperations` all do:
```java
exchange.getIn().setHeader(FtpConstants.FILE_LOCAL_WORK_PATH,
local.getPath());
```
and both readers take a `String` and build the `File` themselves:
```java
String local =
exchange.getIn().getHeader(FileConstants.FILE_LOCAL_WORK_PATH, String.class);
if (local != null) {
File f = new File(local);
```
in `FileOperations.handleFileAsFileSource` and
`GenericFileProcessStrategySupport`. `FileProducerFileBodyGetsMovedTest` sets
it the same way, with `temporaryFile.getAbsolutePath()`.
The other three declarations of this same header already have it right.
`FtpConstants`, `FilesConstants` and `SmbConstants` all say:
```java
@Metadata(label = "consumer", description = "Path to the local work file, if
local work directory is used.",
javaType = "String")
public static final String FILE_LOCAL_WORK_PATH =
Exchange.FILE_LOCAL_WORK_PATH;
```
so the catalog contradicts itself about one header across the file-based
components: `file.json` calls `CamelFileLocalWorkPath` a `File`, while
`ftp.json`, `ftps.json`, `sftp.json`, `mina-sftp.json`, `smb.json` and
`azure-files.json` call it a `String`. The terse "The local work path" does not
say it is a path *string* either.
Setting a `File` as the docs say does work, because `getHeader(...,
String.class)` converts it - but then the producer reconstructs a `File` from
`File.toString()`, and the header the ftp consumers actually hand over is a
String, so nobody reading the camel-file header table gets an accurate picture
of what is in the exchange.
## Fix
Give the camel-file declaration the same type and wording as the other three.
No code changes, so nothing that works today stops working. The regenerated
`file.json` files are included; the other components' JSON is already correct
and untouched.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]