omarmahamid opened a new issue, #6407:
URL: https://github.com/apache/incubator-kie-drools/issues/6407

   
   I'm encountering a null value when working with a serialized and then 
deserialized KieBase, particularly during the package merge phase.
   
   
   During the merge process, existing rules from the "old" package are removed 
**BEFORE** new rules are added. In this removal phase, the engine evaluates 
terminal node associations using:
   
   ````
   sinkNotExclusivelyAssociatedWithTerminal
   ````
   
   This method internally relies on AbstractTerminalNode#isTerminalNodeOf, 
which iterates over pathEndNodes:
   
   ```java
   public final boolean isTerminalNodeOf(LeftTupleNode node) {
       for (PathEndNode pathEndNode : getPathEndNodes()) {
           if (pathEndNode.hasPathNode(node)) {
               return true;
           }
       }
       return false;
   }
   ```
   
   
   Problem:
   
   pathEndNodes is defined as:
   
   
   ````java
   private transient PathEndNode[] pathEndNodes;
   ````
   
   Since it's transient, it is not restored during deserialization, and it is 
typically re-initialized during ReteooBuilder#addRule. However, at the time of 
rule removal, this initialization hasn’t occurred yet — meaning 
getPathEndNodes() returns null, leading to a NullPointerException inside the 
for loop.
   
   
   
   ## Question:
   
   Is this behavior expected?
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to