You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2026/10/15 15:30:35 UTC
(camel) branch fix/CAMEL-25689 created (now 8520c620719b)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch fix/CAMEL-25689
in repository https://gitbox.apache.org/repos/asf/camel.git
at 8520c620719b CAMEL-25689: camel-toon - Upgrade JToon to 2.0.7
This branch includes the following new commits:
new 8520c620719b CAMEL-25689: camel-toon - Upgrade JToon to 2.0.7
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(camel) 01/01: CAMEL-25689: camel-toon - Upgrade JToon to 2.0.7
Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch fix/CAMEL-25689
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 8520c620719b2270f633a3c5012173eb27aaec85
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Oct 15 17:30:16 2026 +0200
CAMEL-25689: camel-toon - Upgrade JToon to 2.0.7
JToon 2.0.6 removes the lengthMarker component of EncodeOptions, as the
TOON specification no longer has the [#N] array length marker. The
lengthMarker option of the toon data format is therefore removed.
With strict=false, JToon 2.0.6 applies only the non-strict recoveries of
the TOON specification and fails on other malformed TOON, instead of
returning null or a partial result. The description of the strict option
now says so.
Supersedes #27890.
Co-Authored-By: Claude Opus 5.5 (1M context) <no...@anthropic.com>
Signed-off-by: Claus Ibsen <cl...@gmail.com>
---
.../org/apache/camel/catalog/dataformats/toon.json | 5 ++-
.../org/apache/camel/catalog/models/toon.json | 5 ++-
.../apache/camel/catalog/schemas/camel-spring.xsd | 15 ++-------
.../apache/camel/catalog/schemas/camel-xml-io.xsd | 15 ++-------
.../camel/catalog/schemas/camelYamlDsl-model.json | 16 ++-------
.../dataformat/toon/ToonDataFormatConfigurer.java | 7 ----
.../org/apache/camel/dataformat/toon/toon.json | 5 ++-
.../camel/dataformat/toon/ToonDataFormat.java | 17 +++-------
.../camel/dataformat/toon/ToonDataFormatTest.java | 18 +++++-----
.../org/apache/camel/model/dataformat/toon.json | 5 ++-
.../camel/model/dataformat/ToonDataFormat.java | 38 ++--------------------
.../reifier/dataformat/ToonDataFormatReifier.java | 1 -
.../apache/camel/java/out/JavaDslModelWriter.java | 1 -
.../java/org/apache/camel/xml/in/ModelParser.java | 1 -
.../java/org/apache/camel/xml/out/ModelWriter.java | 1 -
.../org/apache/camel/yaml/out/YamlModelWriter.java | 1 -
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 14 ++++++++
.../dsl/yaml/deserializers/ModelDeserializers.java | 8 +----
.../resources/schema/camelYamlDsl-canonical.json | 8 +----
.../resources/schema/camelYamlDsl-model.json | 16 ++-------
.../generated/resources/schema/camelYamlDsl.json | 8 +----
parent/pom.xml | 2 +-
22 files changed, 55 insertions(+), 152 deletions(-)
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json
index a45eeb267e26..5d2b6d93b885 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/dataformats/toon.json
@@ -19,8 +19,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent", "group": "common", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "COMMA", "description": "Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length Marker", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json
index 7bb7784a39ae..f82156daa665 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/models/toon.json
@@ -16,8 +16,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent", "group": "common", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "COMMA", "description": "Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length Marker", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
index e438e41c1419..8d07290062b9 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-spring.xsd
@@ -10303,16 +10303,6 @@ Number of spaces per indentation level. Default value: 2
<xs:documentation xml:lang="en">
<![CDATA[
Delimiter used for tabular array rows and inline primitive arrays. Default value: COMMA
-]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="lengthMarker" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">
-<![CDATA[
-Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.
-Default value: false
]]>
</xs:documentation>
</xs:annotation>
@@ -10321,8 +10311,9 @@ Default value: false
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing. Default value:
-true
+Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries
+of the TOON specification, such as accepting an array whose length differs from the declared length; other malformed
+TOON still fails. Default value: true
]]>
</xs:documentation>
</xs:annotation>
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
index 81f71962e73e..7eae091914f4 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camel-xml-io.xsd
@@ -9425,16 +9425,6 @@ Number of spaces per indentation level. Default value: 2
<xs:documentation xml:lang="en">
<![CDATA[
Delimiter used for tabular array rows and inline primitive arrays. Default value: COMMA
-]]>
- </xs:documentation>
- </xs:annotation>
- </xs:attribute>
- <xs:attribute name="lengthMarker" type="xs:string">
- <xs:annotation>
- <xs:documentation xml:lang="en">
-<![CDATA[
-Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.
-Default value: false
]]>
</xs:documentation>
</xs:annotation>
@@ -9443,8 +9433,9 @@ Default value: false
<xs:annotation>
<xs:documentation xml:lang="en">
<![CDATA[
-Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing. Default value:
-true
+Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries
+of the TOON specification, such as accepting an array whose length differs from the declared length; other malformed
+TOON still fails. Default value: true
]]>
</xs:documentation>
</xs:annotation>
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
index 60af524015b7..4aa55e017a97 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/schemas/camelYamlDsl-model.json
@@ -13723,25 +13723,15 @@
"kind" : "attribute",
"index" : 2,
"group" : "common"
- }, {
- "name" : "lengthMarker",
- "type" : "boolean",
- "description" : "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- "title" : "Length Marker",
- "default" : "false",
- "displayName" : "Length Marker",
- "kind" : "attribute",
- "index" : 3,
- "group" : "common"
}, {
"name" : "strict",
"type" : "boolean",
- "description" : "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malformed TOON still fails.",
"title" : "Strict",
"default" : "true",
"displayName" : "Strict",
"kind" : "attribute",
- "index" : 4,
+ "index" : 3,
"group" : "common"
}, {
"name" : "contentTypeHeader",
@@ -13751,7 +13741,7 @@
"default" : "true",
"displayName" : "Content Type Header",
"kind" : "attribute",
- "index" : 5,
+ "index" : 4,
"group" : "common"
} ]
},
diff --git a/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java b/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java
index 6497c75109e4..ca2b872f8c12 100644
--- a/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java
+++ b/components/camel-toon/src/generated/java/org/apache/camel/dataformat/toon/ToonDataFormatConfigurer.java
@@ -25,7 +25,6 @@ public class ToonDataFormatConfigurer extends org.apache.camel.support.component
map.put("ContentTypeHeader", boolean.class);
map.put("Delimiter", java.lang.String.class);
map.put("Indent", int.class);
- map.put("LengthMarker", boolean.class);
map.put("Strict", boolean.class);
ALL_OPTIONS = map;
}
@@ -38,8 +37,6 @@ public class ToonDataFormatConfigurer extends org.apache.camel.support.component
case "contentTypeHeader": target.setContentTypeHeader(property(camelContext, boolean.class, value)); return true;
case "delimiter": target.setDelimiter(property(camelContext, java.lang.String.class, value)); return true;
case "indent": target.setIndent(property(camelContext, int.class, value)); return true;
- case "lengthmarker":
- case "lengthMarker": target.setLengthMarker(property(camelContext, boolean.class, value)); return true;
case "strict": target.setStrict(property(camelContext, boolean.class, value)); return true;
default: return false;
}
@@ -57,8 +54,6 @@ public class ToonDataFormatConfigurer extends org.apache.camel.support.component
case "contentTypeHeader": return boolean.class;
case "delimiter": return java.lang.String.class;
case "indent": return int.class;
- case "lengthmarker":
- case "lengthMarker": return boolean.class;
case "strict": return boolean.class;
default: return null;
}
@@ -72,8 +67,6 @@ public class ToonDataFormatConfigurer extends org.apache.camel.support.component
case "contentTypeHeader": return target.isContentTypeHeader();
case "delimiter": return target.getDelimiter();
case "indent": return target.getIndent();
- case "lengthmarker":
- case "lengthMarker": return target.isLengthMarker();
case "strict": return target.isStrict();
default: return null;
}
diff --git a/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json b/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json
index a45eeb267e26..5d2b6d93b885 100644
--- a/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json
+++ b/components/camel-toon/src/generated/resources/META-INF/org/apache/camel/dataformat/toon/toon.json
@@ -19,8 +19,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent", "group": "common", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "COMMA", "description": "Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length Marker", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git a/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java b/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java
index caea472a4de1..33e603cf7e39 100644
--- a/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java
+++ b/components/camel-toon/src/main/java/org/apache/camel/dataformat/toon/ToonDataFormat.java
@@ -59,10 +59,9 @@ public class ToonDataFormat extends ServiceSupport
@Metadata(description = "Delimiter used for tabular array rows and inline primitive arrays.",
defaultValue = "COMMA", enums = "COMMA,TAB,PIPE")
private String delimiter = Delimiter.COMMA.name();
- @Metadata(description = "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- defaultValue = "false", javaType = "java.lang.Boolean")
- private boolean lengthMarker = EncodeOptions.DEFAULT.lengthMarker();
- @Metadata(description = "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ @Metadata(description = "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict"
+ + " recoveries of the TOON specification, such as accepting an array whose length differs from the"
+ + " declared length; other malformed TOON still fails.",
defaultValue = "true", javaType = "java.lang.Boolean")
private boolean strict = DecodeOptions.DEFAULT.strict();
@Metadata(description = "Whether the data format should set the Content-Type header to text/toon when marshalling.",
@@ -129,7 +128,7 @@ public class ToonDataFormat extends ServiceSupport
}
private EncodeOptions encodeOptions() {
- return new EncodeOptions(indent, resolveDelimiter(), lengthMarker, KeyFolding.OFF, Integer.MAX_VALUE);
+ return new EncodeOptions(indent, resolveDelimiter(), KeyFolding.OFF, Integer.MAX_VALUE);
}
private DecodeOptions decodeOptions() {
@@ -161,14 +160,6 @@ public class ToonDataFormat extends ServiceSupport
this.delimiter = delimiter;
}
- public boolean isLengthMarker() {
- return lengthMarker;
- }
-
- public void setLengthMarker(boolean lengthMarker) {
- this.lengthMarker = lengthMarker;
- }
-
public boolean isStrict() {
return strict;
}
diff --git a/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java b/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java
index 89b3bac6860a..97ea67f564cc 100644
--- a/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java
+++ b/components/camel-toon/src/test/java/org/apache/camel/dataformat/toon/ToonDataFormatTest.java
@@ -215,12 +215,6 @@ class ToonDataFormatTest extends CamelTestSupport {
assertThat(toon).contains(" inner");
}
- @Test
- void lengthMarkerOptionPrefixesArrayLength() {
- String toon = template.requestBody("direct:lengthMarker", List.of("a", "b"), String.class);
- assertThat(toon).contains("[#");
- }
-
@Test
void contentTypeHeaderIsSetByDefault() {
Exchange exchange = template.request("direct:marshal", e -> e.getIn().setBody(Map.of("ok", true)));
@@ -251,7 +245,7 @@ class ToonDataFormatTest extends CamelTestSupport {
}
@Test
- void strictFalseUsesBestEffortParsing() {
+ void strictFalseAcceptsArrayLengthMismatch() {
Object result = template.requestBody("direct:strictFalse", "tags[2]: a,b,c");
assertThat(result).isInstanceOf(Map.class);
@SuppressWarnings("unchecked")
@@ -262,6 +256,15 @@ class ToonDataFormatTest extends CamelTestSupport {
assertThat(tags).containsExactly("a", "b", "c");
}
+ @Test
+ void malformedToonFailsWhenNotStrict() {
+ // the [#N] length marker is no longer part of the TOON specification
+ assertThatThrownBy(() -> template.requestBody("direct:strictFalse", "tags[#2]: a,b", Object.class))
+ .isInstanceOf(CamelExecutionException.class)
+ .cause()
+ .isInstanceOf(IllegalArgumentException.class);
+ }
+
@Test
void emptyJsonStringMarshalFails() {
assertThatThrownBy(() -> template.requestBody("direct:marshal", "", String.class))
@@ -304,7 +307,6 @@ class ToonDataFormatTest extends CamelTestSupport {
from("direct:pipe").marshal(dataFormat().toon().delimiter("PIPE").end());
from("direct:unmarshalPipe").unmarshal(dataFormat().toon().delimiter("PIPE").end());
from("direct:indent").marshal(dataFormat().toon().indent(4).end());
- from("direct:lengthMarker").marshal(dataFormat().toon().lengthMarker(true).end());
from("direct:noContentType").marshal(dataFormat().toon().contentTypeHeader(false).end());
from("direct:strictFalse").unmarshal(dataFormat().toon().strict(false).end());
}
diff --git a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json
index 7bb7784a39ae..f82156daa665 100644
--- a/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json
+++ b/core/camel-core-model/src/generated/resources/META-INF/org/apache/camel/model/dataformat/toon.json
@@ -16,8 +16,7 @@
"id": { "index": 0, "kind": "attribute", "displayName": "Id", "group": "common", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The id of this node" },
"indent": { "index": 1, "kind": "attribute", "displayName": "Indent", "group": "common", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 2, "description": "Number of spaces per indentation level." },
"delimiter": { "index": 2, "kind": "attribute", "displayName": "Delimiter", "group": "common", "required": false, "type": "enum", "javaType": "java.lang.String", "enum": [ "COMMA", "TAB", "PIPE" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "COMMA", "description": "Delimiter used for tabular array rows and inline primitive arrays." },
- "lengthMarker": { "index": 3, "kind": "attribute", "displayName": "Length Marker", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths." },
- "strict": { "index": 4, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing." },
- "contentTypeHeader": { "index": 5, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
+ "strict": { "index": 3, "kind": "attribute", "displayName": "Strict", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malfor [...]
+ "contentTypeHeader": { "index": 4, "kind": "attribute", "displayName": "Content Type Header", "group": "common", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the data format should set the Content-Type header to text\/toon when marshalling." }
}
}
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java
index 31ebb077732a..f6419c82e8b9 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/ToonDataFormat.java
@@ -43,12 +43,9 @@ public class ToonDataFormat extends DataFormatDefinition implements ContentTypeH
enums = "COMMA,TAB,PIPE")
private String delimiter;
@XmlAttribute
- @Metadata(description = "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- defaultValue = "false",
- javaType = "java.lang.Boolean")
- private String lengthMarker;
- @XmlAttribute
- @Metadata(description = "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ @Metadata(description = "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict"
+ + " recoveries of the TOON specification, such as accepting an array whose length differs from the"
+ + " declared length; other malformed TOON still fails.",
defaultValue = "true", javaType = "java.lang.Boolean")
private String strict;
@XmlAttribute
@@ -64,7 +61,6 @@ public class ToonDataFormat extends DataFormatDefinition implements ContentTypeH
super(source);
this.indent = source.indent;
this.delimiter = source.delimiter;
- this.lengthMarker = source.lengthMarker;
this.strict = source.strict;
this.contentTypeHeader = source.contentTypeHeader;
}
@@ -73,7 +69,6 @@ public class ToonDataFormat extends DataFormatDefinition implements ContentTypeH
this();
this.indent = builder.indent;
this.delimiter = builder.delimiter;
- this.lengthMarker = builder.lengthMarker;
this.strict = builder.strict;
this.contentTypeHeader = builder.contentTypeHeader;
}
@@ -99,14 +94,6 @@ public class ToonDataFormat extends DataFormatDefinition implements ContentTypeH
this.delimiter = delimiter;
}
- public String getLengthMarker() {
- return lengthMarker;
- }
-
- public void setLengthMarker(String lengthMarker) {
- this.lengthMarker = lengthMarker;
- }
-
public String getStrict() {
return strict;
}
@@ -133,7 +120,6 @@ public class ToonDataFormat extends DataFormatDefinition implements ContentTypeH
private String indent;
private String delimiter;
- private String lengthMarker;
private String strict;
private String contentTypeHeader;
@@ -161,24 +147,6 @@ public class ToonDataFormat extends DataFormatDefinition implements ContentTypeH
return this;
}
- /**
- * Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain
- * lengths.
- */
- public Builder lengthMarker(String lengthMarker) {
- this.lengthMarker = lengthMarker;
- return this;
- }
-
- /**
- * Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain
- * lengths.
- */
- public Builder lengthMarker(boolean lengthMarker) {
- this.lengthMarker = Boolean.toString(lengthMarker);
- return this;
- }
-
/**
* Whether to enable strict validation when unmarshalling TOON.
*/
diff --git a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java
index 9e99ef930761..fe243807d5d5 100644
--- a/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java
+++ b/core/camel-core-reifier/src/main/java/org/apache/camel/reifier/dataformat/ToonDataFormatReifier.java
@@ -32,7 +32,6 @@ public class ToonDataFormatReifier extends DataFormatReifier<ToonDataFormat> {
protected void prepareDataFormatConfig(Map<String, Object> properties) {
properties.put("indent", definition.getIndent());
properties.put("delimiter", definition.getDelimiter());
- properties.put("lengthMarker", definition.getLengthMarker());
properties.put("strict", definition.getStrict());
}
}
diff --git a/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
index 08726f2dd734..4dfdcb1d70cf 100644
--- a/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
+++ b/core/camel-java-io/src/generated/java/org/apache/camel/java/out/JavaDslModelWriter.java
@@ -3372,7 +3372,6 @@ public class JavaDslModelWriter extends JavaDslModelWriterSupport {
doWriteIdentifiedTypeAttributes(sb, def);
doWriteAttribute(sb, "indent", def.getIndent(), "2");
doWriteAttribute(sb, "delimiter", def.getDelimiter(), "COMMA");
- doWriteAttribute(sb, "lengthMarker", def.getLengthMarker(), "false");
doWriteAttribute(sb, "strict", def.getStrict(), "true");
doWriteAttribute(sb, "contentTypeHeader", def.getContentTypeHeader(), "true");
}
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index 8beb70e5816d..125ddb30f0c4 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -2104,7 +2104,6 @@ public class ModelParser extends BaseParser {
case "contentTypeHeader": def.setContentTypeHeader(val); yield true;
case "delimiter": def.setDelimiter(val); yield true;
case "indent": def.setIndent(val); yield true;
- case "lengthMarker": def.setLengthMarker(val); yield true;
case "strict": def.setStrict(val); yield true;
default: yield identifiedTypeAttributeHandler().accept(def, key, val);
}, noElementHandler(), noValueHandler());
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 554ece49b258..6b50a43de7b4 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -2758,7 +2758,6 @@ public class ModelWriter extends BaseWriter {
doWriteIdentifiedTypeAttributes(def);
doWriteAttribute("indent", def.getIndent(), "2");
doWriteAttribute("delimiter", def.getDelimiter(), "COMMA");
- doWriteAttribute("lengthMarker", def.getLengthMarker(), "false");
doWriteAttribute("strict", def.getStrict(), "true");
doWriteAttribute("contentTypeHeader", def.getContentTypeHeader(), "true");
endElement(name);
diff --git a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
index 85612baebdc6..656b8958b7f6 100644
--- a/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
+++ b/core/camel-yaml-io/src/generated/java/org/apache/camel/yaml/out/YamlModelWriter.java
@@ -2759,7 +2759,6 @@ public class YamlModelWriter extends YamlModelWriterSupport {
doWriteIdentifiedTypeAttributes(jo, def);
doWriteAttribute(jo, "indent", def.getIndent(), "2");
doWriteAttribute(jo, "delimiter", def.getDelimiter(), "COMMA");
- doWriteAttribute(jo, "lengthMarker", def.getLengthMarker(), "false");
doWriteAttribute(jo, "strict", def.getStrict(), "true");
doWriteAttribute(jo, "contentTypeHeader", def.getContentTypeHeader(), "true");
return jo;
diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index ebcf624762ff..44f117657ad1 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -875,3 +875,17 @@ The consumer now sets the `CamelMiloNodeId` header on every exchange, including
Stopping a consumer now deletes its monitored items. Previously they stayed on the server while another endpoint kept
the shared connection open, so a restarted consumer received each value twice. While the server is unreachable, the
stop waits until the client's next attempt to reconnect has failed.
+
+=== camel-toon - the lengthMarker option is removed
+
+`camel-toon` now uses JToon 2.0.7, which follows a newer version of the TOON specification.
+
+The `lengthMarker` option of the TOON data format is removed, because the TOON specification no longer has the `[#N]`
+array length marker. Remove the option from the data format in Java, XML and YAML routes. TOON text with a `[#N]` array
+header, such as the output of a data format with `lengthMarker=true`, now fails to unmarshal in both strict and
+non-strict mode; in Camel 4.23 it already failed in strict mode (the default). To read such data, remove the `#` from
+its array headers (`tags[#2]:` becomes `tags[2]:`).
+
+With `strict=false`, unmarshalling no longer returns `null` or a partial result for malformed TOON. Only the non-strict
+recoveries of the TOON specification apply, such as accepting an array whose length differs from the declared length;
+other malformed TOON fails with `IllegalArgumentException`, as in strict mode.
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index cc102eea2e2e..d49c52f650d6 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -19343,8 +19343,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
@YamlProperty(name = "delimiter", type = "enum:COMMA,TAB,PIPE", defaultValue = "COMMA", description = "Delimiter used for tabular array rows and inline primitive arrays.", displayName = "Delimiter"),
@YamlProperty(name = "id", type = "string", description = "The id of this node", displayName = "Id"),
@YamlProperty(name = "indent", type = "number", defaultValue = "2", description = "Number of spaces per indentation level.", displayName = "Indent"),
- @YamlProperty(name = "lengthMarker", type = "boolean", defaultValue = "false", description = "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.", displayName = "Length Marker"),
- @YamlProperty(name = "strict", type = "boolean", defaultValue = "true", description = "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing.", displayName = "Strict")
+ @YamlProperty(name = "strict", type = "boolean", defaultValue = "true", description = "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malformed TOON still fails.", displayName = "Strict")
}
)
public static class ToonDataFormatDeserializer extends YamlDeserializerBase<ToonDataFormat> {
@@ -19382,11 +19381,6 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
target.setIndent(val);
break;
}
- case "lengthMarker": {
- String val = asText(node);
- target.setLengthMarker(val);
- break;
- }
case "strict": {
String val = asText(node);
target.setStrict(val);
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
index ae62903636aa..4df0bad7f730 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-canonical.json
@@ -8719,16 +8719,10 @@
"description" : "Number of spaces per indentation level.",
"default" : 2
},
- "lengthMarker" : {
- "type" : "boolean",
- "title" : "Length Marker",
- "description" : "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- "default" : false
- },
"strict" : {
"type" : "boolean",
"title" : "Strict",
- "description" : "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malformed TOON still fails.",
"default" : true
}
}
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
index 60af524015b7..4aa55e017a97 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl-model.json
@@ -13723,25 +13723,15 @@
"kind" : "attribute",
"index" : 2,
"group" : "common"
- }, {
- "name" : "lengthMarker",
- "type" : "boolean",
- "description" : "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- "title" : "Length Marker",
- "default" : "false",
- "displayName" : "Length Marker",
- "kind" : "attribute",
- "index" : 3,
- "group" : "common"
}, {
"name" : "strict",
"type" : "boolean",
- "description" : "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malformed TOON still fails.",
"title" : "Strict",
"default" : "true",
"displayName" : "Strict",
"kind" : "attribute",
- "index" : 4,
+ "index" : 3,
"group" : "common"
}, {
"name" : "contentTypeHeader",
@@ -13751,7 +13741,7 @@
"default" : "true",
"displayName" : "Content Type Header",
"kind" : "attribute",
- "index" : 5,
+ "index" : 4,
"group" : "common"
} ]
},
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
index fb5f7c8b3b38..ff5a9269f053 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camelYamlDsl.json
@@ -10926,16 +10926,10 @@
"description" : "Number of spaces per indentation level.",
"default" : 2
},
- "lengthMarker" : {
- "type" : "boolean",
- "title" : "Length Marker",
- "description" : "Whether to prefix array lengths with a hash marker so arrays render as hash-prefixed lengths instead of plain lengths.",
- "default" : false
- },
"strict" : {
"type" : "boolean",
"title" : "Strict",
- "description" : "Whether to enable strict validation when unmarshalling TOON. When false, JToon uses best-effort parsing.",
+ "description" : "Whether to enable strict validation when unmarshalling TOON. When false, the decoder applies the non-strict recoveries of the TOON specification, such as accepting an array whose length differs from the declared length; other malformed TOON still fails.",
"default" : true
}
}
diff --git a/parent/pom.xml b/parent/pom.xml
index 1f072fa7b645..7e3e99e2b800 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -182,7 +182,7 @@
<fory-version>1.7.7</fory-version>
<ph-ubl-version>10.2.0</ph-ubl-version>
<j8583-version>3.0.1</j8583-version>
- <jtoon-version>2.0.5</jtoon-version>
+ <jtoon-version>2.0.7</jtoon-version>
<jakarta-jms-api-version>3.1.0</jakarta-jms-api-version>
<jakarta-persistence-api-version>3.2.0</jakarta-persistence-api-version>
<jakarta-json-api-version>2.1.3</jakarta-json-api-version>