Federico Mariani created CAMEL-24165:
----------------------------------------

             Summary: camel-soap - 
SoapDataFormat.Builder.ignoreUnmarshalledHeaders(boolean) infinitely recurses 
(StackOverflowError); option also dropped by reifier
                 Key: CAMEL-24165
                 URL: https://issues.apache.org/jira/browse/CAMEL-24165
             Project: Camel
          Issue Type: Bug
          Components: camel-soap
            Reporter: Federico Mariani
         Attachments: 
SoapDataFormatBuilderIgnoreUnmarshalledHeadersIssueTest.java

*Severity:* High
*Affects:* since CAMEL-22354 added the option (4.x)

h3. Problem A - StackOverflowError
{{SoapDataFormat.Builder.ignoreUnmarshalledHeaders(boolean)}}:
{code:java}
public Builder ignoreUnmarshalledHeaders(boolean ignoreUnmarshalledHeaders) {
    return 
ignoreUnmarshalledHeaders(Boolean.valueOf(ignoreUnmarshalledHeaders)); // 
self-call
}
{code}
{{Boolean.valueOf(boolean)}} returns a {{Boolean}} that unboxes straight back 
into the same {{(boolean)}} overload (the only other overload takes 
{{String}}). Guaranteed {{StackOverflowError}}. Every other builder in the file 
uses {{Boolean.toString(...)}}.

Java DSL {{new 
SoapDataFormat.Builder().contextPath("...").ignoreUnmarshalledHeaders(true).end()}}
 -> immediate {{StackOverflowError}} at route build (attached reproducer 
confirms; stack repeats {{SoapDataFormat.java:298}}).

h3. Problem B - reifier silent-ignore
{{SoapDataFormatReifier.prepareDataFormatConfig}} never puts 
{{ignoreUnmarshalledHeaders}} into the properties map, so even via XML/YAML DSL 
the option never reaches the runtime data format: inbound SOAP headers keep 
being recorded in {{UNMARSHALLED_HEADER_LIST}} and re-marshalled into the 
outgoing envelope despite opt-out. Combined with Problem A, the option is 
unusable from every DSL.

h3. Suggested fix
A: {{this.ignoreUnmarshalledHeaders = 
Boolean.toString(ignoreUnmarshalledHeaders); return this;}}
B: add {{properties.put("ignoreUnmarshalledHeaders", 
definition.getIgnoreUnmarshalledHeaders());}} to the reifier.

h3. Reproducer
Attached {{SoapDataFormatBuilderIgnoreUnmarshalledHeadersIssueTest.java}} 
covers Problem A ({{StackOverflowError}}); RED on current code.

----
_Reported by Claude Code on behalf of Federico Mariani (Croway). A failing 
JUnit reproducer (confirmed RED on 4.22.0-SNAPSHOT) is attached._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to