This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 03cb0c082587329f0bb2f50585847c10ffefd080
Author: smjain <[email protected]>
AuthorDate: Wed Sep 30 14:01:57 2026 +0530

    CAMEL-25154: camel-vertx-http - drop the camel-file dependency for the 
upload name fallback
    
    The GenericFile file name fallback is practically unreachable, as the file, 
ftp and smb consumers
    always set CamelFileNameOnly, so the upload name is again the header, then 
multipartUploadName, and
    camel-vertx-http does not depend on camel-file. The InputStream 
(streamDownload) tests are kept.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 components/camel-vertx/camel-vertx-http/pom.xml    |  4 ----
 .../component/vertx/http/VertxHttpProducer.java    | 10 +---------
 .../vertx/http/VertxHttpRemoteFileBodyTest.java    | 23 ++++++----------------
 3 files changed, 7 insertions(+), 30 deletions(-)

diff --git a/components/camel-vertx/camel-vertx-http/pom.xml 
b/components/camel-vertx/camel-vertx-http/pom.xml
index f0661c13e6ce..fb7e6ec834ff 100644
--- a/components/camel-vertx/camel-vertx-http/pom.xml
+++ b/components/camel-vertx/camel-vertx-http/pom.xml
@@ -43,10 +43,6 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-vertx-common</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-file</artifactId>
-        </dependency>
         <dependency>
             <groupId>io.vertx</groupId>
             <artifactId>vertx-web-client</artifactId>
diff --git 
a/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpProducer.java
 
b/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpProducer.java
index fc5a571614fc..d3ba891e0c12 100644
--- 
a/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpProducer.java
+++ 
b/components/camel-vertx/camel-vertx-http/src/main/java/org/apache/camel/component/vertx/http/VertxHttpProducer.java
@@ -37,7 +37,6 @@ import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.WrappedFile;
-import org.apache.camel.component.file.GenericFile;
 import org.apache.camel.component.vertx.common.VertxBufferConverter;
 import org.apache.camel.support.DefaultAsyncProducer;
 import org.apache.camel.support.MessageHelper;
@@ -110,14 +109,7 @@ public class VertxHttpProducer extends 
DefaultAsyncProducer {
                         // not a local file, such as a remote file (ftp, sftp, 
smb) with its content in memory,
                         // so send its content
                         buf = message.getMandatoryBody(Buffer.class);
-                        // the header first, so it can be overridden, then the 
name of the file itself
-                        fileName = message.getHeader(Exchange.FILE_NAME_ONLY, 
String.class);
-                        if (fileName == null && body instanceof GenericFile<?> 
gf) {
-                            fileName = gf.getFileNameOnly();
-                        }
-                        if (fileName == null) {
-                            fileName = multipartName;
-                        }
+                        fileName = message.getHeader(Exchange.FILE_NAME_ONLY, 
multipartName, String.class);
                     }
                     if (multipart) {
                         String type = MimeTypeHelper.probeMimeType(fileName);
diff --git 
a/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRemoteFileBodyTest.java
 
b/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRemoteFileBodyTest.java
index 27e00192d0fb..390bb5e586f6 100644
--- 
a/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRemoteFileBodyTest.java
+++ 
b/components/camel-vertx/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpRemoteFileBodyTest.java
@@ -41,7 +41,7 @@ public class VertxHttpRemoteFileBodyTest extends 
VertxHttpTestSupport {
 
     @Test
     public void testRemoteFileBody() throws Exception {
-        Exchange out = send(getProducerUri() + "/echo", false, true);
+        Exchange out = send(getProducerUri() + "/echo", false);
 
         assertFalse(out.isFailed(), "Should not fail");
         assertEquals("Hello World", out.getMessage().getBody(String.class));
@@ -50,7 +50,7 @@ public class VertxHttpRemoteFileBodyTest extends 
VertxHttpTestSupport {
     @Test
     public void testRemoteFileStreamBody() throws Exception {
         // streamDownload=true: the content is an InputStream
-        Exchange out = send(getProducerUri() + "/echo", true, true);
+        Exchange out = send(getProducerUri() + "/echo", true);
 
         assertFalse(out.isFailed(), "Should not fail");
         assertEquals("Hello World", out.getMessage().getBody(String.class));
@@ -58,7 +58,7 @@ public class VertxHttpRemoteFileBodyTest extends 
VertxHttpTestSupport {
 
     @Test
     public void testRemoteFileBodyMultipartUpload() throws Exception {
-        Exchange out = send(getProducerUri() + 
"/upload?multipartUpload=true&multipartUploadName=cheese", false, true);
+        Exchange out = send(getProducerUri() + 
"/upload?multipartUpload=true&multipartUploadName=cheese", false);
 
         assertFalse(out.isFailed(), "Should not fail");
         assertEquals("hello.txt=Hello World", 
out.getMessage().getBody(String.class));
@@ -66,27 +66,16 @@ public class VertxHttpRemoteFileBodyTest extends 
VertxHttpTestSupport {
 
     @Test
     public void testRemoteFileStreamBodyMultipartUpload() throws Exception {
-        Exchange out = send(getProducerUri() + 
"/upload?multipartUpload=true&multipartUploadName=cheese", true, true);
+        Exchange out = send(getProducerUri() + 
"/upload?multipartUpload=true&multipartUploadName=cheese", true);
 
         assertFalse(out.isFailed(), "Should not fail");
         assertEquals("hello.txt=Hello World", 
out.getMessage().getBody(String.class));
     }
 
-    @Test
-    public void testRemoteFileBodyMultipartUploadFileNameFromFile() throws 
Exception {
-        // without the CamelFileNameOnly header the name of the file is used, 
not the form field name
-        Exchange out = send(getProducerUri() + 
"/upload?multipartUpload=true&multipartUploadName=cheese", false, false);
-
-        assertFalse(out.isFailed(), "Should not fail");
-        assertEquals("hello.txt=Hello World", 
out.getMessage().getBody(String.class));
-    }
-
-    private Exchange send(String uri, boolean stream, boolean fileNameHeader) 
throws Exception {
+    private Exchange send(String uri, boolean stream) throws Exception {
         CompletableFuture<Exchange> future = template.asyncSend(uri, exchange 
-> {
             exchange.getMessage().setBody(createRemoteFile(stream));
-            if (fileNameHeader) {
-                exchange.getMessage().setHeader(Exchange.FILE_NAME_ONLY, 
"hello.txt");
-            }
+            exchange.getMessage().setHeader(Exchange.FILE_NAME_ONLY, 
"hello.txt");
         });
         // the exchange must complete, without the content being sent it never 
did
         return future.get(10, TimeUnit.SECONDS);

Reply via email to