saravanakumar1987 opened a new pull request, #30621:
URL: https://github.com/apache/camel/pull/30621

   # Description
   
   Fixes [CAMEL-27401](https://issues.apache.org/jira/browse/CAMEL-27401).
   
   ## Summary
   
   `GroovyValidationException.getIndex` added the length of the platform line 
separator for each line before a syntax error. So an LF script on Windows and a 
CRLF script on Linux got an index one off per earlier line. The method now 
finds the line of the error in the script itself, so every platform gets the 
same index.
   
   - A script whose line terminators match the platform keeps its index.
   - `CamelCatalog.validateLanguageExpression` and `validateLanguagePredicate` 
return this index in their result for the language `groovy`.
   
   ### Why the method counts LF only
   
   In Groovy 5.1.3, `LexerATNSimulator.consume` of the ANTLR runtime increments 
the line only for LF. So Groovy reports a syntax error in a script with CR line 
terminators on line 1.
   
   ## Tests
   
   - `testValidateExpressionIndexWithLfAndCrLf` of `GroovyLanguageTest` checks 
the index for scripts with LF, CRLF, and mixed line terminators.
   - The old method fails it on Windows at the LF script and on Linux at the 
CRLF script.
   - On Windows, `testValidateExpression` of the same class and 
`testValidateGroovyLanguage` of `CamelCatalogTest` failed before the change, 
and both pass now.
   - On Windows, `CamelCatalogTest` passes all 148 tests, and one of the 137 
tests of `camel-groovy` fails for another reason 
([CAMEL-27408](https://issues.apache.org/jira/browse/CAMEL-27408)).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I ran `mvn clean install -Dquickly -DskipTests` in the root folder on 
the parent commit, b1919763fb4b. Then I ran the tests of 
`components/camel-groovy`, installed it with `mvn install -nsu 
-Dtest=GroovyLanguageTest`, and ran `CamelCatalogTest` in 
`catalog/camel-catalog`.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   Claude Code (Anthropic) drafted the change and this text, and ran the builds 
and tests named above.
   
   _Claude Code on behalf of saravanakumar1987_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to