[JBoss JIRA] Created: (JBRULES-3139) NPE in KnowledgeAgentImpl due to missing change set
by Wolfgang Laun (JIRA)
NPE in KnowledgeAgentImpl due to missing change set
---------------------------------------------------
Key: JBRULES-3139
URL: https://issues.jboss.org/browse/JBRULES-3139
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Reporter: Wolfgang Laun
Assignee: Mark Proctor
A missing Change Set causes a NPE in KnowledgeAgentImpl.
import java.net.URL;
import org.drools.*;
import org.drools.agent.*;
import org.drools.conf.*;
import org.drools.builder.*;
import org.drools.io.*;
public void setup() throws Exception {
KnowledgeBaseConfiguration kBaseConfig =
KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
kBaseConfig.setOption(EventProcessingOption.STREAM);
// kBaseConfig.setOption( cehOption );
ResourceChangeScannerConfiguration rcsConf =
ResourceFactory.getResourceChangeScannerService()
.newResourceChangeScannerConfiguration();
rcsConf.setProperty("drools.resource.scanner.interval", "20");
ResourceFactory.getResourceChangeScannerService().configure( rcsConf );
KnowledgeAgentConfiguration kaConf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaConf.setProperty("drools.agent.scanDirectories", "true");
kaConf.setProperty("drools.agent.scanResources", "true");
kaConf.setProperty("drools.agent.newInstance", "false");
KnowledgeBase kBase =
KnowledgeBaseFactory.newKnowledgeBase(kBaseConfig);
KnowledgeAgent kAgent =
KnowledgeAgentFactory.newKnowledgeAgent( "drools agent", kBase, kaConf);
String urlString = "file://tmp/MissingChangeSet.xml";
try {
URL url = new URL(urlString);
Resource urlResource = ResourceFactory.newUrlResource(url);
if( urlResource != null ){
System.out.println( "Resource " + urlResource );
}
kAgent.applyChangeSet( urlResource );
} catch (Exception e) {
System.out.println("Caught exception: " + e.getMessage());
e.printStackTrace();
}
}
Caught exception: null
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 hashcode.Main.setup(Main.java:75)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[JBoss JIRA] Created: (JBRULES-2801) Entry-point defaults for type, rule, package
by Wolfgang Laun (JIRA)
Entry-point defaults for type, rule, package
--------------------------------------------
Key: JBRULES-2801
URL: https://jira.jboss.org/browse/JBRULES-2801
Project: Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Implement the definition of the default entry point for an Event or Fact type via a metadata attribute, e.g.:
declare X
@role( event )
@entry-point( y )
end
so that this
a) declares the entry-point in the KnowledgeBase (the same way from entry-point "x" does)
b) removes the need to use from entry-point with all patterns referring to X
c) would still let me override the entry point with a "from entry-point" clause.
The same attribute can be used inside a rule, where it is associated with all fact patterns without an explicit entry point. Here it also overrides an entry-point declared with the type's declare, if any.
Since all rule attributes may also be used at package level (outside rules), this includes the new entry-point attribute. It will then be honoured in rules according to the current strategy for all other rule attributes.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[JBoss JIRA] Created: (JBRULES-3001) Free form expression constraints: unexpected execution result; unexpected failure to compile
by Wolfgang Laun (JIRA)
Free form expression constraints: unexpected execution result; unexpected failure to compile
---------------------------------------------------------------------------------------------
Key: JBRULES-3001
URL: https://issues.jboss.org/browse/JBRULES-3001
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
Given
public class Customer {
int custid;
//...
}
The following rule always fires, for any value of custid.
rule "articles of a customer"
when
$c: Customer( 150 <= custid <= 250 ) returns true
then
System.out.println( "Customer1 " + $c.getCustid() );
end
But the constraint
$c: Customer( 100 <= custid )
is refused by the compiler:
Unable to build constraint as '100' is invalid : [Rule name='articles of a customer']
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[JBoss JIRA] Created: (JBRULES-2986) Confusing error reporting due to incomplete constraint
by Wolfgang Laun (JIRA)
Confusing error reporting due to incomplete constraint
------------------------------------------------------
Key: JBRULES-2986
URL: https://issues.jboss.org/browse/JBRULES-2986
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
declare Article
artid : int;
artname : String;
custid : int;
end
declare Customer
custid : int
end
rule "articles of a customer"
when
$c: Customer( $custid: custid )
$a: Article( $artid, artname == ("mou" + "se"), $custid : custid == $custid )
then
end
Produces many error messages (see below), where line number 1 and column numnber 1 are incorrect.
Expect: only one error message, with correct line number.
====================================================================
Unable to Analyse Expression $artid:
[Error: Failed to compile: 2 compilation error(s):
- (1,1) unable to resolve method using strict-mode: ex50.Article.$artid()
- (1,1) unqualified type in strict mode for: $artid]
[Near : {... $artid ....}]
^
[Line: 1, Column: 1] : [Rule name='articles of a customer']
Rule Compilation error : [Rule name='articles of a customer']
ex50/Rule_articles_of_a_customer_0.java (14:690) : $artid cannot be resolved
====================================================================
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[JBoss JIRA] Created: (JBRULES-2987) Literal expression not possible in constraint
by Wolfgang Laun (JIRA)
Literal expression not possible in constraint
---------------------------------------------
Key: JBRULES-2987
URL: https://issues.jboss.org/browse/JBRULES-2987
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 3.0-beta3
Reporter: Wolfgang Laun
Assignee: Mark Proctor
declare Article
artid : int;
artname : String;
custid : int;
end
declare Customer
custid : int
endrule "articles of a customer"
when
$c: Customer( $custid: custid )
$a: Article( $artid: artid, artname == "mou" + "se", $custid : custid == $custid )
then
end
This produces the (misleading) error message below, but should work according to Mark Proctor.
Notice that artname == ("mou" + "se") works correctly.
Unable to return Declaration for identifier '"mou" + "se"' : [Rule name='articles of a customer']
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[JBoss JIRA] Created: (JBRULES-2878) NPE due to session.update with 1 or 2 invalid operands
by Wolfgang Laun (JIRA)
NPE due to session.update with 1 or 2 invalid operands
------------------------------------------------------
Key: JBRULES-2878
URL: https://issues.jboss.org/browse/JBRULES-2878
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 5.1.1.FINAL
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Counter counter = new Counter( initial );
this.session.insert( counter );
And now each of these calls
session.update( session.getFactHandle( null ), null );
session.update( session.getFactHandle( counter ), null );
session.update( session.getFactHandle( null ), counter );
results in a NPE
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.drools.common.ObjectTypeConfigurationRegistry.getObjectTypeConf(ObjectTypeConfigurationRegistry.java:58)
at org.drools.common.NamedEntryPoint.update(NamedEntryPoint.java:382)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:981)
at org.drools.common.AbstractWorkingMemory.update(AbstractWorkingMemory.java:954)
at org.drools.impl.StatefulKnowledgeSessionImpl.update(StatefulKnowledgeSessionImpl.java:266)
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[JBoss JIRA] Created: (JBRULES-3002) Invalid comparison operator (=) causes EmptyStackException in DRLParser/ParserHelper
by Wolfgang Laun (JIRA)
Invalid comparison operator (=) causes EmptyStackException in DRLParser/ParserHelper
------------------------------------------------------------------------------------
Key: JBRULES-3002
URL: https://issues.jboss.org/browse/JBRULES-3002
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
class Customer {
int custid; //...
}
rule x
when
$c: Customer( custid = 100 ) // Typo, wanted: "=="
then end
[0,0]: Line 47:0 unexpected exception at input 'rule'. Exception: java.util.EmptyStackException. Stack trace:
java.util.EmptyStackException
at java.util.Stack.peek(Stack.java:102)
at java.util.Stack.pop(Stack.java:84)
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:292)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:471)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years
[JBoss JIRA] Created: (JBRULES-2761) Restriction operator parameters should be strings, not token sequences
by Wolfgang Laun (JIRA)
Restriction operator parameters should be strings, not token sequences
----------------------------------------------------------------------
Key: JBRULES-2761
URL: https://jira.jboss.org/browse/JBRULES-2761
Project: Drools
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Reporter: Wolfgang Laun
Assignee: Mark Proctor
User defined operators (similar to "matches" or the temporal ops) may have parameters, written in '[' and ']' after the identifier denoting the relational operator. Text between the brackets is currently parsed as a "chunk", requiring the text to be composed from tokens recognized by the lexer. This is too restrictive since all Unicode characters that aren't letters (and this part of an identifier) are simply dropped.
It should be simple to parse the text between '[' and ']' as a special form of recursive string, with brackets as delimiters. This means that op[foo[1]] is OK, but op{bar[[] is not.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years