Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import org.apache.camel.Exchange;
import org.apache.camel.InvalidPayloadException;
import org.apache.camel.WrappedFile;
import org.apache.camel.support.DefaultProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -710,6 +711,10 @@ private String getInputPath(Exchange exchange) throws InvalidPayloadException, I
File file = (File) body;
validateFileSize(file.getAbsolutePath());
return file.getAbsolutePath();
} else if (body instanceof WrappedFile<?> wf) {
File file = (File) wf.getFile();
Copy link
Contributor

Choose a reason for hiding this comment

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

You cannot type cast directly to File, as WrappedFile can also come from FTP and then its another kind, or azure file that is also type etc. So you need to do
Object f = wf.getFile
if (f instanceof File file) ...

validateFileSize(file.getAbsolutePath());
return file.getAbsolutePath();
}

throw new InvalidPayloadException(exchange, String.class);
Expand Down
Loading