[JBoss JIRA] Created: (JBRULES-2788) NPE in AbstractWorkingMemory due to session.retract(null)
by Wolfgang Laun (JIRA)
NPE in AbstractWorkingMemory due to session.retract(null)
---------------------------------------------------------
Key: JBRULES-2788
URL: https://jira.jboss.org/browse/JBRULES-2788
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.1.1.FINAL
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Fix For: 5.2.0.M1
StatefulKnowledgeSession kSession = ...;
kSession.retract( null );
Notice that this might occur if kSession.getFactHandle() returns null because the fact object
is invalid or already gone etc.
The above call causes
java.lang.NullPointerException
at org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1261)
at org.drools.common.AbstractWorkingMemory.retract(AbstractWorkingMemory.java:1242)
at org.drools.impl.StatefulKnowledgeSessionImpl.retract(StatefulKnowledgeSessionImpl.java:255)
at resource.Main.exec(Main.java:92)
Expected: This should be ignored, or throw an Exception with a reasonable diagnostic. (Javadoc does not say that an exception may be thrown.)
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 1 month
[JBoss JIRA] Created: (JBRULES-1925) ClassCastException problem with reading working memory using ObjectInputStream
by Przemyslaw Rozycki (JIRA)
ClassCastException problem with reading working memory using ObjectInputStream
------------------------------------------------------------------------------
Key: JBRULES-1925
URL: https://jira.jboss.org/jira/browse/JBRULES-1925
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.0.7
Environment: JDK 1.5.0_11
Reporter: Przemyslaw Rozycki
Assignee: Mark Proctor
I experienced the problem while reading WorkingMemory using ObjectInputStream.
Here is the code:
public class DroolsTest5 {
public static void main(String[] args) {
Properties props = new Properties();
props.setProperty("file", "<<place a path to any working DRL here>>");
RuleAgent ruleAgent = RuleAgent.newRuleAgent(props);
Fact fact1 = new Fact("a","b");
RuleBase ruleBase = ruleAgent.getRuleBase();
WorkingMemory baseWm = ruleBase.newStatefulSession(false);
baseWm.insert(fact1);
Iterator iter1 = baseWm.iterateObjects();
while (iter1.hasNext()) {
System.out.println(iter1.next());
}
System.out.println("=====");
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(baseWm);
oos.close();
byte[] buf = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
ObjectInputStream ois = new ObjectInputStream(bais);
WorkingMemory wm = (WorkingMemory) ois.readObject();
Iterator iter2 = wm.iterateObjects();
while (iter2.hasNext()) {
System.out.println(iter2.next());
}
System.out.println("=====");
} catch (Exception e) {
e.printStackTrace();
}
}
public static class Fact implements Serializable {
String name;
String id;
public Fact(String _name, String _id) {
name = _name;
id = _id;
}
public String getId() {
return id;
}
public String getName() {
return name;
}
@Override
public String toString() {
return "Name: " + name + ", Id: " + id;
}
}
}
And here is an exception I get:
java.lang.ClassCastException: java.io.ObjectInputStream
at org.drools.reteoo.Rete$ClassObjectTypeConf.readObject(Rete.java:605)
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:585)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1809)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.drools.util.AbstractHashTable.readExternal(AbstractHashTable.java:66)
at org.drools.util.ObjectHashMap.readExternal(ObjectHashMap.java:41)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1634)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at com.sample.DroolsTest5.main(DroolsTest5.java:52)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 1 month
[JBoss JIRA] Created: (JBRULES-1996) NPE when using directory scanner and drl is incorrect.
by Przemyslaw Rozycki (JIRA)
NPE when using directory scanner and drl is incorrect.
------------------------------------------------------
Key: JBRULES-1996
URL: https://jira.jboss.org/jira/browse/JBRULES-1996
Project: JBoss Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core
Affects Versions: 4.0.7
Environment: Sun JDK 1.5.0_11, Kubuntu Linux 8.10, x86, 32-bit
Reporter: Przemyslaw Rozycki
Assignee: Mark Proctor
When I use rule agent with directory scanner, and the rule that is being scanned contains a bug, then I receive a NPE instead of error message:
java.lang.NullPointerException
at org.drools.agent.FileScanner.readPackage(FileScanner.java:102)
at org.drools.agent.FileScanner.getChangeSet(FileScanner.java:79)
at org.drools.agent.FileScanner.loadPackageChanges(FileScanner.java:57)
at org.drools.agent.DirectoryScanner.loadPackageChanges(DirectoryScanner.java:43)
at org.drools.agent.RuleAgent.checkForChanges(RuleAgent.java:330)
at org.drools.agent.RuleAgent.refreshRuleBase(RuleAgent.java:298)
at org.drools.agent.RuleAgent.configure(RuleAgent.java:284)
at org.drools.agent.RuleAgent.init(RuleAgent.java:208)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:176)
at org.drools.agent.RuleAgent.newRuleAgent(RuleAgent.java:164)
... (further entries of stack trace contains my application's lines)
When I looked into code I found that DirectoryScanner object, used by the agent uses FileScanner object to scan each file in a directory. And the file scanner does not have a listener set. That's why the NPE is thrown.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 1 month
[JBoss JIRA] Resolved: (JBRULES-2273) setting the Conflictresolver when you get a KnowledgeBase using KnowledgeAgent
by Mark Proctor (JIRA)
[ https://issues.jboss.org/browse/JBRULES-2273?page=com.atlassian.jira.plug... ]
Mark Proctor resolved JBRULES-2273.
-----------------------------------
Resolution: Rejected
> setting the Conflictresolver when you get a KnowledgeBase using KnowledgeAgent
> ------------------------------------------------------------------------------
>
> Key: JBRULES-2273
> URL: https://issues.jboss.org/browse/JBRULES-2273
> Project: Drools
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: drools-core (expert)
> Affects Versions: 5.0.1.FINAL
> Reporter: Edgardo Carena
> Assignee: Mark Proctor
> Priority: Critical
> Labels: agent, conflict, resolver
>
> a feature or at least a work-around to set a specific ConflictResolver when you set up a KnowledgeBase using the KnowledgeAgentFactory and a ResourceFactory.
> Currently your apidocs (http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/apidocs/org/droo...) state:
> "The follow properties have not yet been migrated from the Drools 4.0 api:
> * drools.executorService = <qualified class name>
> * drools.conflictResolver = <qualified class name>
> * drools.ruleBaseUpdateHandler = <qualified class name>"
> The only known work-around is to set up a RuleBaseConfiguration in this way:
> conf = new RuleBaseConfiguration();
> conf.setConflictResolver(new FifoConflictResolver());
> and then use it to get a KnowledgeBase using KnowledgeBaseFactory.newKnowledgeBase(conf), however this cannot be applied when you are using the KnowledgeAgentFactory.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 1 month
[JBoss JIRA] Created: (JBRULES-2968) mistake in determining the type of an eval expression
by Wolfgang Laun (JIRA)
mistake in determining the type of an eval expression
-------------------------------------------------------
Key: JBRULES-2968
URL: https://issues.jboss.org/browse/JBRULES-2968
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 3.0.1
Reporter: Wolfgang Laun
Assignee: Mark Proctor
Priority: Blocker
This rule compiled correctly a few weeks ago where MyDate contains the int field "year":
rule "Day in leap year"
when
$d: MyDate( $y: year, eval( $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 ) )
then
System.out.println( $d.toString() + " is in a leap year" );
end
But now errors are reported:
Unable to build expression for 'inline-eval' : [Error: was expecting type: java.lang.Boolean; but found type: java.lang.Integer]
[Near : {... $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 ....}]
^
[Line: 1, Column: 46]' $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 '
[Error: was expecting type: java.lang.Boolean; but found type: java.lang.Integer]
[Near : {... $y % 4 == 0 && $y % 100 != 0 || $y % 400 == 0 ....}]
^
[Line: 1, Column: 46] : [Rule name='Day in leap year']
[Error: was expecting type: java.lang.Boolean; but found type: java.lang.Integer]
[Near : {... $y % 4 == 0 && $y % 100
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 1 month