[JBoss JIRA] Created: (JBRULES-3042) KnowledgeAgent.applyChangeSet(notExistingResource) should throw an understandable exception instead of a NullPointerException
by Geoffrey De Smet (JIRA)
KnowledgeAgent.applyChangeSet(notExistingResource) should throw an understandable exception instead of a NullPointerException
-----------------------------------------------------------------------------------------------------------------------------
Key: JBRULES-3042
URL: https://issues.jboss.org/browse/JBRULES-3042
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Reporter: Geoffrey De Smet
Fix For: 5.3.0.M1
Discovered by the guvnor-examples MortgageClientExample
The exception is essentially eaten here in KnowledgeAgentImpl:
{code}
try {
changeSet = reader.read( resource.getReader() );
} catch ( Exception e ) {
this.listener.exception( new RuntimeException(
"Unable to parse ChangeSet",
e ) );
}
{code}
OK, it logs it, but it doesn't throw an exception (might be related to use of the Agent in spring??? where we don't want it to die on a network IO problem?).
Instead a NPE occurs later because the changeSet is still null:
{code}
Exception in thread "main" java.lang.NullPointerException
at org.drools.agent.impl.KnowledgeAgentImpl.processChangeSet(KnowledgeAgentImpl.java:223)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:189)
at org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:174)
at org.drools.guvnor.examples.mortgage.client.MortgageClientExample.readKnowledgeBase(MortgageClientExample.java:81)
at org.drools.guvnor.examples.mortgage.client.MortgageClientExample.main(MortgageClientExample.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
{code}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-3057) Misleading error message for missing constructor
by Wolfgang Laun (JIRA)
Misleading error message for missing constructor
------------------------------------------------
Key: JBRULES-3057
URL: https://issues.jboss.org/browse/JBRULES-3057
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.CR1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0
If an undeclared constructor is called in a consequence, a very strange error message is produced:
- error text is "Failed to compileShared" ("Shared" is not used by the app)
- The message part meant ot identify the location of the error is misleanding, e.g.,
Near : {... p3.setName( "Paul" ); ....}
with the marker ("^") pointing to "Paul".
public static class Person {
private String name;
public Person(String name){
this.name = name;
}
public String getField1() {
return field1;
}
public void setName( String name ) {
this.name = name;
}
public String getName() {
return name;
}
}
@Test
public void testExistsIterativeModifyBug() {
String str = "";
str += "package org.simple ";
str += "import Person ";
str += "rule xxx ";
str += "when ";
str += "then ";
str += " Person = new Person() ";
str += "end ";
KnowledgeBase kbase = loadKnowledgeBaseFromString( str );
assertFalse( kBuilder.hasErrors() );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.fireAllRules();
ksession.dispose();
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-3014) Too many error messages (and stack dumps!) due to simple syntax error
by Wolfgang Laun (JIRA)
Too many error messages (and stack dumps!) due to simple syntax error
---------------------------------------------------------------------
Key: JBRULES-3014
URL: https://issues.jboss.org/browse/JBRULES-3014
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.M2
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0.CR1
Person( age > ($age * 2) ) ) ### typo - note the redundant ')'
This produces nested Empty Stack and Class Cast Exceptions, lots of stack dumps and three error messages:
[0,0]: Line 30:0 unexpected exception at input 'rule'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:85)
at java.util.Stack.pop(Stack.java:67)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:409)
at org.drools.lang.ParserHelper.end(ParserHelper.java:723)
at org.drools.lang.DRLParser.rule(DRLParser.java:915)
at org.drools.lang.DRLParser.statement(DRLParser.java:248)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:143)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:307)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:486)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at express.Main.setup(Main.java:48)
at express.Main.main(Main.java:92)
[0,0]: Line 31:8 unexpected exception at input '"mvel"'. Exception: java.lang.ClassCastException: org.drools.lang.api.CEDescrBuilderImpl cannot be cast to org.drools.lang.api.AttributeSupportBuilder. Stack trace:
java.lang.ClassCastException: org.drools.lang.api.CEDescrBuilderImpl cannot be cast to org.drools.lang.api.AttributeSupportBuilder
at org.drools.lang.ParserHelper.start(ParserHelper.java:667)
at org.drools.lang.DRLParser.stringAttribute(DRLParser.java:1294)
at org.drools.lang.DRLParser.attribute(DRLParser.java:1073)
at org.drools.lang.DRLParser.statement(DRLParser.java:257)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:143)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:307)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:486)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at express.Main.setup(Main.java:48)
at express.Main.main(Main.java:92)
[31,8]: [ERR 107] Line 31:8 mismatched input '"mvel"' expecting one of the following tokens: '[package, import, global, declare, function, rule, query]'.
[0,0]: Line 39:0 unexpected exception at input 'rule'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:85)
at java.util.Stack.pop(Stack.java:67)
at org.drools.lang.ParserHelper.popParaphrases(ParserHelper.java:409)
at org.drools.lang.ParserHelper.end(ParserHelper.java:723)
at org.drools.lang.DRLParser.rule(DRLParser.java:915)
at org.drools.lang.DRLParser.statement(DRLParser.java:248)
at org.drools.lang.DRLParser.compilationUnit(DRLParser.java:143)
at org.drools.compiler.DrlParser.compile(DrlParser.java:225)
at org.drools.compiler.DrlParser.parse(DrlParser.java:136)
at org.drools.compiler.DrlParser.parse(DrlParser.java:141)
at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:307)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:486)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
at express.Main.setup(Main.java:48)
at express.Main.main(Main.java:92)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-3011) Incorrect salience expression => CCE at runtime
by Wolfgang Laun (JIRA)
Incorrect salience expression => CCE at runtime
-----------------------------------------------
Key: JBRULES-3011
URL: https://issues.jboss.org/browse/JBRULES-3011
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.M2
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0.CR1
function int FSAL(){ return 100; }
rule insFirst
salience ( FSAL ) ## Oops, forgot the parens...
when
then
end
No compile-time error. At runtime we get:
Exception in thread "main" org.drools.RuntimeDroolsException: Unexpected exception executing action org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction@354749
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:996)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:730)
at org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:699)
at org.drools.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:218)
at express.Main.execute(Main.java:71)
at express.Main.main(Main.java:93)
Caused by: java.lang.ClassCastException: org.mvel2.util.MethodStub cannot be cast to java.lang.Number
at org.drools.base.mvel.MVELSalienceExpression.getValue(MVELSalienceExpression.java:86)
at org.drools.reteoo.RuleTerminalNode.assertLeftTuple(RuleTerminalNode.java:215)
at org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:189)
at org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:138)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:141)
at org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:59)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)
at org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:143)
at org.drools.reteoo.Rete.assertObject(Rete.java:107)
at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:260)
at org.drools.reteoo.ReteooWorkingMemory$WorkingMemoryReteAssertAction.execute(ReteooWorkingMemory.java:343)
at org.drools.common.AbstractWorkingMemory.executeQueuedActions(AbstractWorkingMemory.java:994)
... 5 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-3070) Incorrect relational operator usage accepted by compiler
by Wolfgang Laun (JIRA)
Incorrect relational operator usage accepted by compiler
--------------------------------------------------------
Key: JBRULES-3070
URL: https://issues.jboss.org/browse/JBRULES-3070
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.CR1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0
Given
class Person { int age; ... }
the following pattern can be written
Person( $name: name, age > 20 > 50 )
And the pattern matches all Person facts with an age > 50.
a) This should cause an error: a boolean (age > 20) cannot be compared with an integer (50)
b) The result implies that some strange interpretation is in effect.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months
[JBoss JIRA] Created: (JBRULES-3059) declare: inconsistent behaviour w.r.t. field redefinition
by Wolfgang Laun (JIRA)
declare: inconsistent behaviour w.r.t. field redefinition
---------------------------------------------------------
Key: JBRULES-3059
URL: https://issues.jboss.org/browse/JBRULES-3059
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.2.0.CR1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0
import Person
declare Person
name : String = "Joe" @key # here only @key is recognized; the initialization is not done
end
declare Employee extends Person
custno : int @key
name : String = "Joe" @key # here @key and initialization are recognized
end
If it cannot be honoured, the initialization should cause an error.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 2 months