You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Federico Mariani (Jira)" <ji...@apache.org> on 2026/07/16 09:39:00 UTC
[jira] [Created] (CAMEL-24163) camel-core - JsonDataFormatReifier passes Jackson-only options to Gson/Fastjson/Jsonb, crashing route startup
Federico Mariani created CAMEL-24163:
----------------------------------------
Summary: camel-core - JsonDataFormatReifier passes Jackson-only options to Gson/Fastjson/Jsonb, crashing route startup
Key: CAMEL-24163
URL: https://issues.apache.org/jira/browse/CAMEL-24163
Project: Camel
Issue Type: Bug
Components: camel-gson
Reporter: Federico Mariani
Attachments: GsonJsonDataFormatUseListReifierIssueTest.java
*Severity:* High
*Affects:* 4.x
h3. Problem
{{JsonDataFormatReifier.prepareDataFormatConfig}} puts a family of Jackson-only options into the property map *unconditionally for every library* (only {{schemaResolver}}/{{namingStrategy}}/{{timezone}}/{{maxStringLength}} are guarded by {{library == Jackson}}):
{code:java}
properties.put("include", definition.getInclude());
properties.put("allowJmsType", definition.getAllowJmsType());
properties.put("collectionType", ...);
properties.put("useList", definition.getUseList());
properties.put("enableFeatures", ...);
properties.put("disableFeatures", ...);
properties.put("allowUnmarshallType", ...);
// ... moduleClassNames, moduleRefs, combineUnicodeSurrogates
{code}
{{GsonDataFormat}}, {{FastjsonDataFormat}} and {{JsonbDataFormat}} have no such setters, and binding is mandatory, so setting any of these documented options crashes route startup.
h3. Failure scenario
{code:xml}
<unmarshal><json library="Gson" useList="true"/></unmarshal>
{code}
{noformat}
PropertyBindingException: Error binding property (useList=true) with name: useList
on bean: org.apache.camel.component.gson.GsonDataFormat
at DataFormatReifier.configureDataFormat(DataFormatReifier.java:316)
{noformat}
Reproduced with {{useList/collectionType/include/enableFeatures/disableFeatures/allowJmsType/allowUnmarshallType}} on Gson, Fastjson and Jsonb.
h3. Suggested fix
Guard the non-Jackson-supported option family per library (mirror the existing {{library == Jackson}} block), or emit a clear "option X is not supported by library Y" message instead of a raw binding failure.
h3. Reproducer
Attached {{GsonJsonDataFormatUseListReifierIssueTest.java}} builds a route with a {{JsonDataFormat}} model ({{library=Gson}}, {{useList=true}}) and asserts the context starts and unmarshals a JSON array to a {{List}}; 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)