Federico Mariani created CAMEL-23991:
----------------------------------------
Summary: camel-yaml-dsl-validator-maven-plugin - application.yaml
ignore check never matches, and static yamlFiles cache is unsafe under parallel
builds and accumulates across modules
Key: CAMEL-23991
URL: https://issues.apache.org/jira/browse/CAMEL-23991
Project: Camel
Issue Type: Bug
Components: camel-yaml-dsl-validator-maven-plugin
Affects Versions: 4.21.0
Reporter: Federico Mariani
Two defects in {{ValidateMojo}}
({{dsl/camel-yaml-dsl/camel-yaml-dsl-validator-maven-plugin/.../ValidateMojo.java}}):
h3. 1. Dead IGNORE_FILE check (lines 48, 198-201)
{{FileUtil.onlyName("application.yaml")}} strips the extension and returns
{{"application"}}, which is compared against {{IGNORE_FILE =
"application.yml"}} — never equal (and {{.yml}} files are never discovered
anyway since the extension filter is {{.yaml}}/{{.camel.yaml}}). Result: a
Spring Boot/Quarkus-style {{src/main/resources/application.yaml}} is validated
against the Camel route schema, producing guaranteed spurious errors (WARN
spam, or build failure with {{failOnError=true}}). The constant should be
{{"application"}} or the comparison should use the raw file name.
h3. 2. static mutable yamlFiles cache in a threadSafe mojo (lines 43, 109,
130-147)
{{private static final Set<File> yamlFiles = new LinkedHashSet<>()}} is shared
JVM-wide. With {{mvn -T}} parallel multi-module builds, one module's
{{findYamlRouters}} mutates the set while another module iterates it (line 135)
→ ConcurrentModificationException or lost/duplicated entries. Even
single-threaded, the set only accumulates: module N re-validates every file
from modules 1..N-1 (O(n^2) work, inflated "Validating N files" counts, and
{{failOnError}} in a later module can fail on an earlier module's files).
Cosmetic bonus: the summary at lines 156-191 prints "errors:N" where N is the
number of *files* with errors, not the error count.
_Filed by Claude Code on behalf of Croway._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)