Bug 1317058

Summary: [GSS](6.2.z)Deletion of logically inserted Fact fails in 6.2
Product: [Retired] JBoss BRMS Platform 6 Reporter: Alessandro Lazarotti <alazarot>
Component: BREAssignee: Mario Fusco <mfusco>
Status: CLOSED EOL QA Contact: Ivo Bek <ibek>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.2.0CC: alazarot, ibek, kverlaen, mfusco, mwinkler, rsynek
Target Milestone: CR1   
Target Release: 6.2.3   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1317026 Environment:
Last Closed: 2020-03-27 19:42:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1317026    
Bug Blocks: 1327763, 1327765    

Description Alessandro Lazarotti 2016-03-11 20:14:45 UTC
+++ This bug was initially created as a clone of Bug #1317026 +++

Description of problem:
When the user tries to delete a Fact that was inserted using the 'insertLogical()' operation, the deletion fails with the below exception:

---------- Exception ---------- 
java.lang.IllegalArgumentException: The FactHandle did not originate from WM : [fact 0:1:1990421361:1990421361:1:DEFAULT:NON_TRAIT:com.company.support.DecisionTableFactValue:com.company.support.DecisionTableFactValue@76a36b71]
	at org.drools.core.common.NamedEntryPoint.delete(NamedEntryPoint.java:474)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.delete(StatefulKnowledgeSessionImpl.java:1505)
	at org.drools.core.impl.StatefulKnowledgeSessionImpl.delete(StatefulKnowledgeSessionImpl.java:1496)
	at com.company.support.DecisionTableRuleTest.factInsertedInWorkingMemoryCannotBeDeleted(DecisionTableRuleTest.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	....

---------- Exception ---------- 

Version-Release number of selected component (if applicable):
6.2.0

How reproducible:
Everytime delete() is executed on a logically inserted Fact.

Steps to Reproduce:
1. Logically insert some fact.
2. Retrieve FactHandle for inserted fact (either via query or KieSession.getFactHandles()).
3. Delete fact using ksession.delete()

Actual results:
Fact deleted.

Expected results:
Exception thrown.

Additional info:
Reproducer attached. Please unzip and unit test DecisionTableRuleTest to see the exception reproduced.

--- Additional comment from JBoss Product and Program Management on 2016-03-11 13:10:17 EST ---

Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

--- Additional comment from Alessandro Lazarotti on 2016-03-11 14:55:38 EST ---

Mario see that it works for 6.2.x branch, but not for 6.3.x, so could be a regression.

If it is not a regression, but a new check added to 6.3.x so:
- Should be incremented the community doc first (to be consumed for product doc) in the TMS chapeter, mentioning that such operation should not be allowed.
- The exception should be clear. An Illegal Operation Exception can be thrown reporting as message something like "Deleting a fact inserted logically is not supported currently".

Comment 3 Ivo Bek 2016-05-04 11:00:50 UTC
Verified in BPM Suite 6.2.3.CR1

The reproducer test DecisionTableRuleTest passed.