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] IOOBE in visitLhsUnary if LHS is invalid #5955

Closed
yurloc opened this issue May 16, 2024 · 1 comment
Closed

[new-parser] IOOBE in visitLhsUnary if LHS is invalid #5955

yurloc opened this issue May 16, 2024 · 1 comment

Comments

@yurloc
Copy link
Contributor

yurloc commented May 16, 2024

Parent issue

Failing tests

  • org.drools.mvel.integrationtests.KieBuilderTest#testMultipleKBaseWithDrlError

Notes

Rule code snippet

rule "test"
  when
    Smurf
  then
end

Error output

00:18:58,390 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [file:/var/home/jlocker/src/github.com/kiegroup/drools/drools-test-coverage/test-compiler-integration/target/test-classes/logback-test.xml]
00:18:58,391 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs multiple times on the classpath.
00:18:58,391 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs at [file:/var/home/jlocker/src/github.com/kiegroup/drools/drools-compiler/target/test-classes/logback-test.xml]
00:18:58,391 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs at [file:/var/home/jlocker/src/github.com/kiegroup/drools/drools-test-coverage/test-suite/target/test-classes/logback-test.xml]
00:18:58,391 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs at [file:/var/home/jlocker/src/github.com/kiegroup/drools/drools-core/target/test-classes/logback-test.xml]
00:18:58,391 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback-test.xml] occurs at [file:/var/home/jlocker/src/github.com/kiegroup/drools/drools-test-coverage/test-compiler-integration/target/test-classes/logback-test.xml]
00:18:58,474 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
00:18:58,475 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
00:18:58,483 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [consoleAppender]
00:18:58,488 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
00:18:58,561 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.kie] to WARN
00:18:58,561 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.drools] to WARN
00:18:58,561 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
00:18:58,561 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [consoleAppender] to Logger[ROOT]
00:18:58,562 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
00:18:58,563 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@400cff1a - Registering current configuration as safe fallback point

### parse : ANTLR4_PARSER_ENABLED = true
line 5:2 no viable alternative at input 'Smurf\n  then'
00:18:59.320 [main] ERROR o.d.d.parser.antlr4.DRLParserWrapper.parse:77 - Exception while creating PackageDescr
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
	at java.base/java.util.Objects.checkIndex(Objects.java:359)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:1092)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$LhsUnaryContext.accept(DRLParser.java:2548)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at org.drools.drl.parser.antlr4.DRLParserBaseVisitor.visitLhsUnarySingle(DRLParserBaseVisitor.java:201)
	at org.drools.drl.parser.antlr4.DRLParser$LhsUnarySingleContext.accept(DRLParser.java:2117)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1106)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhs(DRLVisitorImpl.java:538)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:346)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$RuledefContext.accept(DRLParser.java:1667)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1106)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDrlStatementdef(DRLVisitorImpl.java:166)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDrlStatementdef(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$DrlStatementdefContext.accept(DRLParser.java:526)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1106)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:102)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$CompilationUnitContext.accept(DRLParser.java:436)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
	at org.drools.drl.parser.antlr4.DRLParserHelper.compilationUnitContext2PackageDescr(DRLParserHelper.java:94)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:75)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:55)
	at org.drools.drl.parser.DrlParser.lambda$parse$2(DrlParser.java:191)
	at org.drools.drl.parser.DrlParser.compileWithAntlr4Parser(DrlParser.java:204)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:191)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:179)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:168)
	at org.drools.compiler.builder.impl.resources.DrlResourceHandler.process(DrlResourceHandler.java:55)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.buildResource(PackageDescrBuilder.java:73)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.build(PackageDescrBuilder.java:51)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackageDescr(CompositeKnowledgeBuilderImpl.java:173)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:116)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:109)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:274)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:220)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:84)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:285)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:251)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:208)
	at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:149)
	at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:134)
	at org.drools.mvel.integrationtests.KieBuilderTest.testMultipleKBaseWithDrlError(KieBuilderTest.java:425)
00:18:59.334 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:kbase1
[5,2]: no viable alternative at input 'Smurf\n  then'
[0,0]: Index 0 out of bounds for length 0
[0,0]: Parser returned a null Package

### parse : ANTLR4_PARSER_ENABLED = true
line 5:2 no viable alternative at input 'Smurf\n  then'
00:18:59.338 [main] ERROR o.d.d.parser.antlr4.DRLParserWrapper.parse:77 - Exception while creating PackageDescr
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
	at java.base/java.util.Objects.checkIndex(Objects.java:359)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:1092)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhsUnary(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$LhsUnaryContext.accept(DRLParser.java:2548)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at org.drools.drl.parser.antlr4.DRLParserBaseVisitor.visitLhsUnarySingle(DRLParserBaseVisitor.java:201)
	at org.drools.drl.parser.antlr4.DRLParser$LhsUnarySingleContext.accept(DRLParser.java:2117)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1106)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitLhs(DRLVisitorImpl.java:538)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:346)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitRuledef(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$RuledefContext.accept(DRLParser.java:1667)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1106)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDrlStatementdef(DRLVisitorImpl.java:166)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDrlStatementdef(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$DrlStatementdefContext.accept(DRLParser.java:526)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitDescrChildren(DRLVisitorImpl.java:1106)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:102)
	at org.drools.drl.parser.antlr4.DRLVisitorImpl.visitCompilationUnit(DRLVisitorImpl.java:83)
	at org.drools.drl.parser.antlr4.DRLParser$CompilationUnitContext.accept(DRLParser.java:436)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visit(AbstractParseTreeVisitor.java:18)
	at org.drools.drl.parser.antlr4.DRLParserHelper.compilationUnitContext2PackageDescr(DRLParserHelper.java:94)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:75)
	at org.drools.drl.parser.antlr4.DRLParserWrapper.parse(DRLParserWrapper.java:55)
	at org.drools.drl.parser.DrlParser.lambda$parse$2(DrlParser.java:191)
	at org.drools.drl.parser.DrlParser.compileWithAntlr4Parser(DrlParser.java:204)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:191)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:179)
	at org.drools.drl.parser.DrlParser.parse(DrlParser.java:168)
	at org.drools.compiler.builder.impl.resources.DrlResourceHandler.process(DrlResourceHandler.java:55)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.buildResource(PackageDescrBuilder.java:73)
	at org.drools.compiler.builder.impl.PackageDescrBuilder.build(PackageDescrBuilder.java:51)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackageDescr(CompositeKnowledgeBuilderImpl.java:173)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:116)
	at org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:109)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:274)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.buildKnowledgePackages(AbstractKieProject.java:220)
	at org.drools.compiler.kie.builder.impl.AbstractKieProject.verify(AbstractKieProject.java:84)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildKieProject(KieBuilderImpl.java:285)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:251)
	at org.drools.compiler.kie.builder.impl.KieBuilderImpl.buildAll(KieBuilderImpl.java:208)
	at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:149)
	at org.drools.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem(KieUtil.java:134)
	at org.drools.mvel.integrationtests.KieBuilderTest.testMultipleKBaseWithDrlError(KieBuilderTest.java:425)
00:18:59.338 [main] ERROR o.d.c.k.b.impl.AbstractKieProject.buildKnowledgePackages:280 - Unable to build KieBaseModel:kbase2
[5,2]: no viable alternative at input 'Smurf\n  then'
[0,0]: Index 0 out of bounds for length 0
[0,0]: Parser returned a null Package

00:18:59.345 [main] ERROR o.d.testcoverage.common.util.KieUtil.getKieBuilderFromKieFileSystem:165 - KieBuilder errors: [Message [id=1, kieBase=kbase1, level=ERROR, path=org/drools/compiler/drl1.drl, line=5, column=0
   text=no viable alternative at input 'Smurf\n  then'], Message [id=2, kieBase=kbase1, level=ERROR, path=org/drools/compiler/drl1.drl, line=0, column=0
   text=Index 0 out of bounds for length 0], Message [id=3, kieBase=kbase1, level=ERROR, path=org/drools/compiler/drl1.drl, line=0, column=0
   text=Parser returned a null Package], Message [id=4, kieBase=kbase2, level=ERROR, path=org/drools/compiler/drl1.drl, line=5, column=0
   text=no viable alternative at input 'Smurf\n  then'], Message [id=5, kieBase=kbase2, level=ERROR, path=org/drools/compiler/drl1.drl, line=0, column=0
   text=Index 0 out of bounds for length 0], Message [id=6, kieBase=kbase2, level=ERROR, path=org/drools/compiler/drl1.drl, line=0, column=0
   text=Parser returned a null Package]]

org.junit.ComparisonFailure: 
Expected :4
Actual   :6
<Click to see difference>


	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at org.drools.mvel.integrationtests.KieBuilderTest.testMultipleKBaseWithDrlError(KieBuilderTest.java:428)
@yurloc
Copy link
Contributor Author

yurloc commented May 22, 2024

Fixed by #5956.

@yurloc yurloc closed this as completed May 22, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to 🎯 Done in 🦉 KIE Podling Board May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🎯 Done
Development

No branches or pull requests

1 participant