Loading and updating a contained child concept causes java.lang.NullPointerException at com.tibco.cep.kernel.helper.BitSet.setBit

Loading and updating a contained child concept causes java.lang.NullPointerException at com.tibco.cep.kernel.helper.BitSet.setBit

book

Article ID: KB0080963

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition 5.2.2, 5.3.0, 5.4.x, 5.5.0

Description

Use Case:

A parent concept with several contained concept arrays is deleted in PreProcessor RuleFunction using "Instance.deleteInstance(parent)". One of the child concepts has a reference concept array. Each of that referenced concepts added is a contained concept in a contained concept array of the parent as well.
The parent concept will be deleted in the PreProcessor RuleFunction, but the deleted child (with referenced concept arrays) can still be loaded using Cluster.DataGrid.CacheLoadConceptByExtIdByUri() or Instance.getByExtIdByUri().
That child is internally marked as deleted, that's why a NullPointerException is thrown when update the child in a Rule/RuleFunction.

Concept Structure for the use case:
parent p --> CONTAINS concept c1 array AND concept c2 array AND concept c3 array
concept c2 --> REFERENCES concept c3 array
 
<timestamp> <agentname> Error [$default.be.mt$.Thread.7] - [runtime.service] [inference-class] Got runtime exception while executing Rule <Rule> Action <entities>
java.lang.NullPointerException
    at com.tibco.cep.kernel.helper.BitSet.setBit(SourceFile:16)
    at com.tibco.cep.runtime.model.element.impl.ConceptImpl.modifyConcept(ConceptImpl.java:645)
    at com.tibco.cep.runtime.model.element.impl.ConceptImpl.modifyConcept(ConceptImpl.java:638)
    at com.tibco.cep.runtime.model.element.impl.property.PropertyImpl.setConceptModified(PropertyImpl.java:72)
    at com.tibco.cep.runtime.model.element.impl.property.simple.PropertyArrayConceptReferenceSimple.addToEnd(PropertyArrayConceptReferenceSimple.java:64)
    at com.tibco.cep.runtime.model.element.impl.property.simple.PropertyArrayConceptReferenceSimple.add(PropertyArrayConceptReferenceSimple.java:70)
    at com.tibco.cep.runtime.model.element.impl.property.simple.PropertyArrayConceptReferenceSimple.set(PropertyArrayConceptReferenceSimple.java:91)
    at be.gen.Rules.rTestSupport$rTestSupport_a.execute(rTestSupport.java:51)
Note: Issue occurs only for persistence type Shared Nothing. ​

Issue/Introduction

A contained child could be loaded in a Rule but his parent (contained concept array) was deleted in a PreProcessor RuleFunction. A NullPointerException thrown when try to update that child.

Environment

All Operating Systems

Resolution

As a workaround for now it is required to clean the contained concept array before deleting the parent concept in PreProcessor.

eg:
Instance.PropertyArray.clear(cpParent.cp4Parent);
Instance.PropertyArray.clear(cpParent.childs);
Instance.deleteInstance(cpParent);

We have raised CR BE-26436 to address the issue in the product.

Additional Information

contained concept, setBit, BitSet.setBit