bob dorobis

Problem- Java BOM with Java Collections

Discussion created by bob dorobis on Aug 15, 2013
Latest reply on Aug 18, 2013 by Jostein Ulseth

I'm developing rules that operate on a Java BOM and am using Blaze Advisor 7.1.1001.

 

I've a class with a parent class that contains a List<String> member intialized as an empty instance of that type.  I have a ruleset that invokes a rule to load a string into the collection.

 

I have a test main{} function in Blaze to invoke the ruleset. But the probllem I have is that is the collection is a null value when the rule fires.

 

Suppose the following class definitions:

 

public class ABC extends DEF {

    public addString(String aString) { this.stringList.add(aString); }
}

 

public class DEF {

    public List<String> stringList = new ArrayList<String>; 

}

 

For the following SRL - when executed I am finding tha ABC.stringList is a null value, not initialized as I expect.

 

theABC is some ABC initially a ABC.

theABC.addString("foo").   // exception thrown as stringList inherited from parent is null

 

 

Anyone have an explanation?

 

Outcomes