Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new-parser] Some rules do not fire in MultiKieBaseTest #5709

Closed
yurloc opened this issue Feb 20, 2024 · 3 comments
Closed

[new-parser] Some rules do not fire in MultiKieBaseTest #5709

yurloc opened this issue Feb 20, 2024 · 3 comments
Assignees

Comments

@yurloc
Copy link
Contributor

yurloc commented Feb 20, 2024

Parent issue

Failing tests

- org.drools.model.codegen.execmodel.MultiKieBaseTest#testFoldersVsPackages
- org.drools.model.codegen.execmodel.MultiKieBaseTest#testHelloMultiKieBasesWithSharedDeclaredType

-> These 2 tests were already fixed probably by other fix (can't be sure which one).

Instead, this test failed in MultiKieBaseTest

  • org.drools.model.codegen.execmodel.MultiKieBaseTest#testHelloWorldWithPackagesAnd2KieBases

Notes

  • STANDARD_FROM_DRL only.

Rule code snippet

  • multiple rules

Error output

13:41:52.267 [main] ERROR o.d.c.kie.util.ChangeSetBuilder.diffResource:187 - Error analyzing the contents of org/pkg2/r2.drl. Skipping.
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -1 out of bounds for byte[141]
	at java.base/java.lang.System.arraycopy(Native Method)
	at java.base/java.util.Arrays.copyOfRangeByte(Arrays.java:3864)
	at java.base/java.util.Arrays.copyOfRange(Arrays.java:3854)
	at org.drools.compiler.kie.util.ChangeSetBuilder.diffDescrs(ChangeSetBuilder.java:247)
	at org.drools.compiler.kie.util.ChangeSetBuilder.diffResource(ChangeSetBuilder.java:172)
	at org.drools.compiler.kie.util.ChangeSetBuilder.build(ChangeSetBuilder.java:98)
	at org.drools.compiler.kie.builder.impl.InternalKieModule.getChanges(InternalKieModule.java:141)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.update(KieContainerImpl.java:246)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.update(KieContainerImpl.java:242)
	at org.drools.compiler.kie.builder.impl.KieContainerImpl.updateToVersion(KieContainerImpl.java:200)
	at org.drools.model.codegen.execmodel.MultiKieBaseTest.testHelloWorldWithPackagesAnd2KieBases(MultiKieBaseTest.java:105)
	...
### parse : ANTLR4_PARSER_ENABLED = true

org.opentest4j.AssertionFailedError: 
expected: 1
 but was: 2
Expected :1
Actual   :2
@tkobayas
Copy link
Contributor

/take

@tkobayas
Copy link
Contributor

tkobayas commented Mar 19, 2024

The root cause is that RuleDescr.getStartCharacter() returns -1 (missed in DRLVisitorImpl), so the kbase is not updated (the error is logged).
https://github.com/apache/incubator-kie-drools/blob/dev-new-parser/drools-compiler/src/main/java/org/drools/compiler/kie/util/ChangeSetBuilder.java#L247

@tkobayas
Copy link
Contributor

Fixed by #5794

@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🎯 Done in 🦉 KIE Podling Board Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants