Issue 18714: RemoveStructuralFeatureValueActionActivation: Determination of position(s) of value to be removed results in inf. loop (fuml-rtf) Source: LieberLieber Software (Mrs. Tanja Mayerhofer, mayerhofer(at)big.tuwien.ac.at.) Nature: Revision Severity: Minor Summary: If a value of a structured value shall be removed and the isRemoveDuplicates flag of the RemoveStruturalFeatureValueAction is set to true or if the removeAt pin was null, the position(s) of the value to be removed are determined by calling the operation int WriteStructuralFeatureActionActivation.position(Value, ValueList, int). The problem is that the last found position is provided as startPosition for the next call of the position operation. Therefore this found position is found again and again in each call of the operation resulting in an infinite loop. Resolution: Replace the following operation call j = this.position(inputValue, featureValue.values, j); with >>> j = this.position(inputValue, featureValue.values, j+1); In line 113 (last statement in while loop of if (action.isRemoveDuplicates) clause) and 121 (last statement in while loop of else if (action.removeAt == null) clause). Resolution: Update RemoveStructuralFeatureValueActionActivation In the case of action.isRemoveDuplicates = false and action.removeAt = null, the issue is correct that the current specification will result in an infinite loop if the given structural feature holds any instances of the given value. However, the issue is not correct for the case action.isRemoveDuplicates = true. In that case, instance of the given value found at position j is removed before the search for the position of the next instance, so beginning the search at position j is correct. Indeed, starting the next search at position j+1 could cause an instance of the value to be skipped, if it happened to come right after the instance that had just been removed. Revised Text: In 8.6.3.2.12 RemoveStructuralFeatureValueActionActivation, in operation doAction, in the third if statement, in the else clause beginning if (value instanceof StructuredValue), in the else clause of the second nested if statement beginning if (action.removeAt == null), within the while statement, replace the statement j = this.position(inputValue, featureValue.values, j); with j = this.position(inputValue, featureValue.values, j + 1); Actions taken: May 14, 2013: received issue October 8, 2015: Resolved December 22, 2015: closed issue Discussion: End of Annotations:===== m: webmaster@omg.org Date: 14 May 2013 03:18:33 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Tanja Mayerhofer Employer: Vienna University of Technology mailFrom: mayerhofer@big.tuwien.ac.at Terms_Agreement: I agree Specification: Semantics of a Foundational Subset for Executable UML Models (fUML) Section: 8.6.3.2.12 RemoveStructuralFeatureValueActionActivation FormalNumber: ptc/2012-10-18 Version: v1.1 Doc_Year: 2012 Doc_Month: October Doc_Day: 18 Page: 306-309 Title: RemoveStructuralFeatureValueActionActivation: Determination of position(s) of value to be removed results in infinite loop Nature: Revision Severity: Minor CODE: 3TMw8 B1: Report Issue Remote Name: hopper.ifs.tuwien.ac.at Remote User: HTTP User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0 Time: 03:18 AM Description: If a value of a structured value shall be removed and the isRemoveDuplicates flag of the RemoveStruturalFeatureValueAction is set to true or if the removeAt pin was null, the position(s) of the value to be removed are determined by calling the operation int WriteStructuralFeatureActionActivation.position(Value, ValueList, int). The problem is that the last found position is provided as startPosition for the next call of the position operation. Therefore this found position is found again and again in each call of the operation resulting in an infinite loop. Resolution: Replace the following operation call j = this.position(inputValue, featureValue.values, j); with >>> j = this.position(inputValue, featureValue.values, j+1); In line 113 (last statement in while loop of if (action.isRemoveDuplicates) clause) and 121 (last statement in while loop of else if (action.removeAt == null) clause).