Copilot commented on code in PR #6341:
URL:
https://github.com/apache/incubator-kie-drools/pull/6341#discussion_r2086190195
##########
drools-reliability/drools-reliability-core/src/main/java/org/drools/reliability/core/ReliableSessionInitializer.java:
##########
@@ -85,8 +85,8 @@ public InternalWorkingMemory init(InternalWorkingMemory
session, PersistedSessio
}
private void onWorkingMemoryAction(InternalWorkingMemory session,
PropagationEntry entry) {
- if (entry instanceof PropagationEntry.Insert) {
- InternalFactHandle fh = ((PropagationEntry.Insert)
entry).getHandle();
+ if (entry instanceof PropagationEntry.Insert || entry instanceof
PropagationEntry.Update) {
+ InternalFactHandle fh =
((PropagationEntry.AbstractPropagationEntry) entry).getHandle();
if (fh.isValid()) {
WorkingMemoryEntryPoint ep = fh.getEntryPoint(session);
((SimpleReliableObjectStore)
ep.getObjectStore()).putIntoPersistedStorage(fh, true);
Review Comment:
Consider verifying that casting entry to
PropagationEntry.AbstractPropagationEntry is valid for all cases of
PropagationEntry.Update to avoid potential ClassCastExceptions. If different
update types exist, consider a more specific type check or handling logic.
```suggestion
if (entry instanceof
PropagationEntry.AbstractPropagationEntry) {
InternalFactHandle fh =
((PropagationEntry.AbstractPropagationEntry) entry).getHandle();
if (fh.isValid()) {
WorkingMemoryEntryPoint ep =
fh.getEntryPoint(session);
((SimpleReliableObjectStore)
ep.getObjectStore()).putIntoPersistedStorage(fh, true);
}
} else {
// Log a warning or handle the unexpected case
System.err.println("Warning: Unsupported
PropagationEntry type: " + entry.getClass().getName());
```
--
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]