Claus Ibsen created CAMEL-27613:
-----------------------------------
Summary: camel-mustache: single delimiter option ignored, wrong
delimiter defaults, stale Javadoc
Key: CAMEL-27613
URL: https://issues.apache.org/jira/browse/CAMEL-27613
Project: Camel
Issue Type: Bug
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-mustache for CAMEL-23832
(PR https://github.com/apache/camel/pull/30949).
These are separate problems of the component; the descriptions PR only
documents the current behavior.
h4. 1. Setting only one of startDelimiter and endDelimiter has no effect
{{MustacheEndpoint.createMustache()}} only passes custom delimiters to
{{DefaultMustacheFactory.compile(reader, name, sm, em)}} when both
{{startDelimiter}} and {{endDelimiter}} are not null. Both fields default to
{{null}}. So {{mustache:foo.mustache?startDelimiter=<%}} without
{{endDelimiter}} compiles the template with {{\{\{}} and {{\}\}}}, and the
option is ignored without a warning. The same happens with both delimiters set
when the {{mustacheFactory}} of the component is not a
{{DefaultMustacheFactory}}.
Proposed change: initialize the fields to {{\{\{}} and {{\}\}}} (matching the
metadata defaults), so one delimiter can be set alone, and log a warning when
delimiters are set but the factory cannot apply them.
h4. 2. The defaultValue of startDelimiter and endDelimiter does not match the
field
The metadata says {{defaultValue = "\{\{"}} and {{defaultValue = "\}\}"}}, but
the fields of {{MustacheEndpoint}} have no initializer and default to {{null}}.
Tools that read the catalog see a default that the endpoint does not have,
which hides problem 1.
Proposed change: fixed together with problem 1 by initializing the fields.
h4. 3. Stale class Javadoc of MustacheComponent
The class Javadoc of {{MustacheComponent}} lists the endpoint options encoding,
startDelimiter and endDelimiter with their defaults, which belong to
{{MustacheEndpoint}} and are documented there. Its HTML is broken:
{{</li></li>}} and no closing {{</ul>}}.
Proposed change: reduce it to one sentence such as "The Mustache component,
which creates MustacheEndpoint instances."
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)