[jboss-jira] [JBoss JIRA] Created: (JBRULES-3196) Infinite loop instead of NPE

Wolfgang Laun (JIRA) jira-events at lists.jboss.org
Fri Sep 2 03:33:26 EDT 2011


Infinite loop instead of NPE
----------------------------

                 Key: JBRULES-3196
                 URL: https://issues.jboss.org/browse/JBRULES-3196
             Project: Drools
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: drools-core  (expert)
    Affects Versions: 5.3.0.Beta1
            Reporter: Wolfgang Laun
            Assignee: Mark Proctor
            Priority: Critical
             Fix For: 5.3.0.CR1


The marked statement results in an infinite loop if the
HashMap gradeMap is not initialized. Expected behaviour
is to throw an exception, e.g. NPE.

import java.util.HashMap;

declare Student
   name : String @key
   gradeMap : HashMap   
end

rule KickOff
when
then
    Student s = new Student( "Joe" );
    insert( s );
end

rule "Subject grade points"
dialect "mvel"
when
   $u : Student()
then
   System.out.println("Adding marks for " + $u.getName() );
   $u.gradeMap["CompSc"] += 100;        ###<<<<<<<<<<<<<<<<<<<<<<<<<<<<< LOOP
   System.out.println("Marks added");
end


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list