[ http://jira.codehaus.org/browse/DROOLS-427?page=comments#action_50102 ]
Michael Neale commented on DROOLS-427: -------------------------------------- I think this is a limitation of the java spec at the moment - nulls don't really have a type (I think) so "null instanceof String" wouldn't ever work, hence the rule engine can never inference the "fact" of a null string with this rule. Suggestion is to wrap this with a object which is not null, and check for null-ness on an attribute of that object. I think java 6 may treat nulls as objects with types, or maybe its C# 3.0, I can't remember and it is late. > Not able to check for null condition > ------------------------------------ > > Key: DROOLS-427 > URL: http://jira.codehaus.org/browse/DROOLS-427 > Project: drools > Type: Bug > Versions: 2.1 > Environment: WINXP & Java > Reporter: Jagpreet Kaur > Assignee: bob mcwhirter > > > I am using JSR94 and drools. > My rule.xml file looks : > <rule-set name="PunchRoundingAndDockingRule" xmlns="http://drools.org/rules" > xmlns:java="http://drools.org/semantics/java" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://drools.org/rules rules.xsd > http://drools.org/semantics/java java.xsd"> > <import>java.lang.Object</import> > <import>java.lang.String</import> > > <!--Rule to check that department is Null--> > <rule name="Checkdepartmentfornull"> > <parameter identifier="department"> > <class>String</class> > </parameter> > <java:condition> > department==null > </java:condition> > > <java:consequence> > System.out.println("department is null"); > </java:consequence> > </rule> > </rule-set> > I am passing department as null but the following condition is never check > and I am not getting any exceptions but > also not getting the "department is null" message on the console. How can I > check for null > condition? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
