gnodet-bot commented on code in PR #28150:
URL: https://github.com/apache/camel/pull/28150#discussion_r4323754075
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/HeaderChecks.java:
##########
@@ -139,12 +164,64 @@ static List<String> timerCounterComparisons(String
content) {
return msgs;
}
+ /**
+ * The {@link #WRONG_NAMES} the content uses as header names, and the
names written as a constant that Exchange does
+ * not have, which fail the route when Camel creates it; once each, the
names go into reported.
+ */
+ static List<String> wrongNames(String content, Set<String> reported) {
+ List<String> msgs = new ArrayList<>();
+ String[] lines = content.split("\n", -1);
+ for (int i = 0; i < lines.length; i++) {
+ Matcher c = EXCHANGE_CONSTANT_NAME.matcher(lines[i]);
+ if (c.find() && isSetOrRemoveName(lines, i)) {
+ String hint = exchangeConstantHint(c.group(1));
+ if (hint != null && reported.add("Exchange." + c.group(1))) {
+ msgs.add("Line " + (i + 1) + ": " + hint);
+ }
+ }
+ Matcher m = CAMEL_HEADER_REF_PATTERN.matcher(lines[i]);
+ while (m.find()) {
Review Comment:
Test comment at find() vs while find()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]