[JBoss JIRA] (JBRULES-3302) Unwanted type coersion of String to float values when using "in" keyword LHS
by Troy Parrish (Created) (JIRA)
Unwanted type coersion of String to float values when using "in" keyword LHS
----------------------------------------------------------------------------
Key: JBRULES-3302
URL: https://issues.jboss.org/browse/JBRULES-3302
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.3.0.Final, 5.2.0.Final
Environment: Windows 7, Rational …
[View More]Application Developer 7.5, Eclipse Helios Service Release 2
Reporter: Troy Parrish
Assignee: Mark Proctor
String values get treated as float values even when fact declares the property as a String when using the "in" keyword to evaluate a String value against a set of values in the lhs of the rule.
Example:
input into session : "10.5"
will match against all of the following values "10.5", "10.50", "10.500" etc when in this format:
when
Fact(string in ("11.5", "10.50", "11.500"))
then
This problem behavior occurs in 5.3.0Final, 5.2.0.Final but not in 5.1.0Final, this is when Expert went from using mvel 2.0.16 to mvel 2.1.0
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[View Less]
12 years, 7 months
[JBoss JIRA] (JBRULES-3377) drools modify command mvel exception
by Mario Fusco (JIRA)
Mario Fusco created JBRULES-3377:
------------------------------------
Summary: drools modify command mvel exception
Key: JBRULES-3377
URL: https://issues.jboss.org/browse/JBRULES-3377
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Reporter: Mario Fusco
Assignee: Mario Fusco
Following exception occurs when trying to execute modify command on stateful
session:
{ with …
[View More](this) {
age = 30
,name = Frank
,id = 0
,likes = nobody
} }
Exception in thread "main" [Error: unable to resolve method:
com.redhat.modifyreproducer.Person.Frank() [arglength=0]]
[Near : {... ,name = Frank ....}]
^
[Line: 5, Column: 1]
at org.mvel2.PropertyAccessor.getMethod(PropertyAccessor.java:977)
at org.mvel2.PropertyAccessor.getBeanProperty(PropertyAccessor.java:687)
at org.mvel2.PropertyAccessor.getNormal(PropertyAccessor.java:202)
at org.mvel2.PropertyAccessor.get(PropertyAccessor.java:171)
at org.mvel2.PropertyAccessor.get(PropertyAccessor.java:151)
at org.mvel2.ast.ASTNode.getReducedValue(ASTNode.java:185)
at
org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106)
at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49)
at org.mvel2.MVEL.eval(MVEL.java:408)
at org.mvel2.util.ParseTools.parseWithExpressions(ParseTools.java:1591)
at org.mvel2.ast.WithNode.getReducedValue(WithNode.java:75)
at
org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106)
at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49)
at org.mvel2.MVEL.eval(MVEL.java:109)
at
org.drools.command.runtime.rule.ModifyCommand.execute(ModifyCommand.java:79)
at
org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:798)
at
org.drools.impl.StatefulKnowledgeSessionImpl.execute(StatefulKnowledgeSessionImpl.java:781)
at com.redhat.modifyreproducer.Main.test(Main.java:52)
at com.redhat.modifyreproducer.Main.main(Main.java:30)
------------------------------------------------------------------------------
First, fact is inserted into the session, next step is creating Modify command
with setter list:
Person p1 = new Person("John", "nobody", 25);
session.execute(CommandFactory.newInsert(p1));
FactHandle fh = session.getFactHandle(p1);
Person p = new Person("Frank", "nobody", 30);
List<Setter> setterList = new ArrayList<Setter>();
setterList.add(CommandFactory.newSetter("age",
String.valueOf(p.getAge())));
setterList.add(CommandFactory.newSetter("name", p.getName()));
setterList.add(CommandFactory.newSetter("likes", p.getLikes()));
setterList.add(CommandFactory.newSetter("id",
String.valueOf(p.getId())));
session.execute(CommandFactory.newModify(fh, setterList));
See an attachment for the details, just build as maven project and run.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[View Less]
12 years, 7 months
[JBoss JIRA] (JBRULES-3390) Drools java.lang.NullPointerException at org.drools.reteoo.RuleTerminalNode
by Alberto Rugnone (JIRA)
Alberto Rugnone created JBRULES-3390:
----------------------------------------
Summary: Drools java.lang.NullPointerException at org.drools.reteoo.RuleTerminalNode
Key: JBRULES-3390
URL: https://issues.jboss.org/browse/JBRULES-3390
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 5.3.0.Final
Environment: eclipse 3.6, Drools 5.3, jdk1.6.0_25_x64
…
[View More]Reporter: Alberto Rugnone
Assignee: Mark Proctor
My application has to monitor when a magnetic contact is activated and when it is contact released event has to be retracted. And viceversa. Here is my rule and the big null pointer I have. Any helps will be very appreciated! Thank you a lot!!
rule "contact activated vs contact released" salience 0 no-loop true
when
$contact_activated : Event(type == EventType.CONTACT_ACTIVATED) ||
$contact_released : Event(type == EventType.CONTACT_RELEASED)
then
if($contact_activated!= null) {
retract($contact_activated);
} else {
retract($contact_released);
}
end
and
I have
java.lang.NullPointerException
at org.drools.reteoo.RuleTerminalNode$SortDeclarations.compare(RuleTerminalNode.java:477)
at org.drools.reteoo.RuleTerminalNode$SortDeclarations.compare(RuleTerminalNode.java:473)
at java.util.Arrays.mergeSort(Arrays.java:1270)
at java.util.Arrays.sort(Arrays.java:1210)
at org.drools.reteoo.RuleTerminalNode.<init>(RuleTerminalNode.java:119)
at org.drools.RuleActivationListenerFactory.createActivationListener(RuleActivationListenerFactory.java:21)
at org.drools.reteoo.builder.ReteooRuleBuilder.addSubRule(ReteooRuleBuilder.java:157)
at org.drools.reteoo.builder.ReteooRuleBuilder.addRule(ReteooRuleBuilder.java:123)
at org.drools.reteoo.ReteooBuilder.addRule(ReteooBuilder.java:110)
at org.drools.reteoo.ReteooRuleBase.addRule(ReteooRuleBase.java:441)
at org.drools.common.AbstractRuleBase.addRule(AbstractRuleBase.java:821)
at org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java:555)
at org.drools.reteoo.ReteooRuleBase.addPackages(ReteooRuleBase.java:458)
at org.drools.impl.KnowledgeBaseImpl.addKnowledgePackages(KnowledgeBaseImpl.java:150)
at it.ipiu.pch.sel.RuleTest.before(RuleTest.java:1272)
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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[View Less]
12 years, 7 months