turing85 opened a new issue, #7088:
URL: https://github.com/apache/camel-quarkus/issues/7088

   ### Bug description
   
   Given the following processor ([source 
(`github.com`)](https://github.com/turing85/camel-quarkus-unmarshal-processor/blob/main/src/main/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessor.java):
   ```java
   public class MyUnmarshalProcessor implements Processor {
     @Override
     public void process(Exchange exchange) throws Exception {
       exchange.setProperty(Exchange.CONTENT_TYPE, "text/plain");
   
       unmarshal(exchange);
       // exchange.setIn(exchange.getOut());
       AttachmentMessage msg = exchange.getIn(AttachmentMessage.class);
     }
   
     private void unmarshal(Exchange exchange) throws Exception {
       try (MimeMultipartDataFormat dataFormat = new MimeMultipartDataFormat()) 
{
         new UnmarshalProcessor(dataFormat).process(exchange);
       }
     }
   }
   ```
   
   and the following test ([source 
(`github.com`)](https://github.com/turing85/camel-quarkus-unmarshal-processor/blob/main/src/test/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessorTest.java):
   ```java
   class MyUnmarshalProcessorTest extends CamelTestSupport {
     @Test
     void test() throws Exception {
       // GIVEN
       String expectedMessage = "Hello, world!";
       String body = """
           ------=_divider
           Content-Type: text/plain; charset=ISO-8859-15
           Content-Transfer-Encoding: 8bit
   
           %s
           ------=_divider
           Content-Type: application/octet-stream
           Content-Transfer-Encoding: base64
           Content-Disposition: attachment; 
filename=JMS_Normalized_Message_Properties
           Content-ID: JMS_Normalized_Message_Properties
   
           SGVsbG8sIHdvcmxkCg==
           ------=_divider--
           """.formatted(expectedMessage);
       Exchange exchange = ExchangeBuilder.anExchange(context())
           .withHeader(Exchange.CONTENT_TYPE,
               "multipart/related; 
type=\"text/plain\";boundary=\"----=_divider\"")
           .withBody(body).build();
   
       // when
       new MyUnmarshalProcessor().process(exchange);
   
       // then
       String actualMessage = exchange.getMessage().getBody(String.class);
       System.out.println(actualMessage);
       Truth.assertThat(actualMessage).isEqualTo(expectedMessage);
     }
   }
   ```
   
   This test succeeds with quarkus `3.18.4` (camel-quarkus `3.18.0`, camel 
`4.9.0`), but with quarkus `3.19.1` (camel-quarkus `3.19.0`, camel `4.10.0`):
   ```bash
   $ ./mvnw clean test
   ...
   [ERROR] Failures: 
   [ERROR]   MyUnmarshalProcessorTest.test:40 expected:
       Hello, world!
   but was:
       ------=_divider
       Content-Type: text/plain; charset=ISO-8859-15
       Content-Transfer-Encoding: 8bit
       
       Hello, world!
       ------=_divider
       Content-Type: application/octet-stream
       Content-Transfer-Encoding: base64
       Content-Disposition: attachment; 
filename=JMS_Normalized_Message_Properties
       Content-ID: JMS_Normalized_Message_Properties
       
       SGVsbG8sIHdvcmxkCg==
       ------=_divider--
   ...
   ```
   
   ## Expected Behaviour
   The test - as-is should succeed in quarkus `3.19.1`
   
   ## Observed Behaviour
   The test fails with the above error
   
   ## Reproducer
   1. clone https://github.com/turing85/camel-quarkus-unmarshal-processor
   ```bash
   git clone https://github.com/turing85/camel-quarkus-unmarshal-processor.git 
&& \
     cd camel-quarkus-unmarshal-processor
   ```
   2. Notice that the application is configured to run with quarkus `3.18.4`:
   ```bash
   cat pom.xml|grep -i "<quarkus.platform.version>"
           <quarkus.platform.version>3.19.1</quarkus.platform.version>
   ```
   3. Run the tests, observe that the tests succeed:
   ```bash
   ./mvnw clean test
   ...
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.250 
s -- in de.turing85.quarkus.camel.unmarshal.processor.MyUnmarshalProcessorTest
   [INFO]
   [INFO] Results:
   [INFO]
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   ...
   ```
   4. Change to quarkus `3.19.1` by applying the follwing patch:
   ```diff
   Subject: [PATCH] Change to quarkus 3.19.1
   ---
   Index: pom.xml
   IDEA additional info:
   Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
   <+>UTF-8
   ===================================================================
   diff --git a/pom.xml b/pom.xml
   --- a/pom.xml        (revision 5716ae9e4cef2b696a1268cc3f785286e73e3c1e)
   +++ b/pom.xml        (date 1741104327754)
   @@ -35,7 +35,7 @@
            <!-- Quarkus versions -->
            
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
            
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
   -        <quarkus.platform.version>3.18.4</quarkus.platform.version>
   +        <quarkus.platform.version>3.19.1</quarkus.platform.version>
   
            <!-- Camel Quarkus -->
            
<camel-quarkus-platform.group-id>io.quarkus.platform</camel-quarkus-platform.group-id>
   ```
   5. Re-run the test, notice that it fails:
   ```bash
   $ ./mvnw clean test
   ...
   [ERROR] Failures: 
   [ERROR]   MyUnmarshalProcessorTest.test:40 expected:
       Hello, world!
   but was:
       ------=_divider
       Content-Type: text/plain; charset=ISO-8859-15
       Content-Transfer-Encoding: 8bit
       
       Hello, world!
       ------=_divider
       Content-Type: application/octet-stream
       Content-Transfer-Encoding: base64
       Content-Disposition: attachment; 
filename=JMS_Normalized_Message_Properties
       Content-ID: JMS_Normalized_Message_Properties
       
       SGVsbG8sIHdvcmxkCg==
       ------=_divider-- 
   ...
   ```
   6. Un-comment [this line 
(`github.com`)](https://github.com/turing85/camel-quarkus-unmarshal-processor/blob/main/src/main/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessor.java#L15)
 by applying the following patch:
   ```diff
   Subject: [PATCH] Change to quarkus 3.19.1, prevent the issue
   ---
   Index: 
src/main/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessor.java
   IDEA additional info:
   Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
   <+>UTF-8
   ===================================================================
   diff --git 
a/src/main/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessor.java
 
b/src/main/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessor.java
   --- 
a/src/main/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessor.java
        (revision af1ac2437160d83609923a1c76f498dc72eb73fb)
   +++ 
b/src/main/java/de/turing85/quarkus/camel/unmarshal/processor/MyUnmarshalProcessor.java
        (date 1741104613664)
   @@ -16,7 +16,7 @@
        exchange.setProperty(Exchange.CONTENT_TYPE, "text/plain");
   
        unmarshal(exchange);
   -    // exchange.setIn(exchange.getOut());
   +    exchange.setIn(exchange.getOut());
        AttachmentMessage msg = exchange.getIn(AttachmentMessage.class);
        for (Map.Entry<String, DataHandler> attachment : 
msg.getAttachments().entrySet()) {
          exchange.setProperty(attachment.getKey(), 
attachment.getValue().getContent());
   Index: pom.xml
   IDEA additional info:
   Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
   <+>UTF-8
   ===================================================================
   diff --git a/pom.xml b/pom.xml
   --- a/pom.xml        (revision af1ac2437160d83609923a1c76f498dc72eb73fb)
   +++ b/pom.xml        (date 1741104609285)
   @@ -35,7 +35,7 @@
            <!-- Quarkus versions -->
            
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
            
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
   -        <quarkus.platform.version>3.18.4</quarkus.platform.version>
   +        <quarkus.platform.version>3.19.1</quarkus.platform.version>
   
            <!-- Camel Quarkus -->
            
<camel-quarkus-platform.group-id>io.quarkus.platform</camel-quarkus-platform.group-id>
   ```
   7. Re-run the test, notice that it succeeds again:
   ```bash
   $ ./mvnw clean test
   ...
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.250 
s -- in de.turing85.quarkus.camel.unmarshal.processor.MyUnmarshalProcessorTest
   [INFO]
   [INFO] Results:
   [INFO]
   [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   ...
   ```
   
   ## Furhter inforomation
   - I was not able to reproduce the bug with pure camel, only with 
camel-quarkus
   - The change in behaviour seems to only affect camel-quarkus in version 
`3.19.0` / camel `4.10.0`, since it worked fine with camel-quarkus `3.18.0` / 
camel `4.9.0`


-- 
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: commits-unsubscr...@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to