Issue 17203: Bug in ForkedToken::withdraw when the baseToken is a ForkedToken (fuml-rtf) Source: Model Driven Solutions (Mr. Ed Seidewitz, ed-s(at)modeldriven.com) Nature: Uncategorized Issue Severity: Summary: Specification: Semantics of a Foundational Subset for Executable UML Models (fUML) (formal/2011-02-01) Subclause: 8.5.2.2.10 ForkedToken ForkedToken::withdraw calls isWithdrawn() to check if its baseToken is withdrawn, and then withdraws it if that is false. The intent is that baseToken.withdraw() only be called once. However, if the baseToken is itself a ForkedToken, then calling withdraw() may only decrement the remainingOffersCount of that token, with isWithdrawn() only becoming true if this count goes to zero. This means that additional calls to withdraw() on the first ForkedToken may result in additional calls to withdraw() on its baseToken, prematurely reducing the remainingOffersCount for the baseToken. This can be avoided by adding an explicit baseTokenIsWithdrawn flag to ForkedToken that is set when the baseToken is withdrawn and then checked to avoid further withdraws. Resolution: agreed Revised Text: In Subclause 8.5.2.2.10, and in Figure 8.27, add the attribute • baseTokenIsWithdrawn: Boolean. Indicates whether withdraw() has been called on the base token. In the withdraw operation, replace: if (!this.baseToken.isWithdrawn()) { this.baseToken.withdraw(); } with: if (!this.baseTokenIsWithdrawn & !this.baseToken.isWithdrawn()) { this.baseToken.withdraw(); // NOTE: This keeps a base token that is a forked token from being // withdrawn more than once, since withdrawing a forked token may // not actually remove it from its fork node holder. this.baseTokenIsWithdrawn = true; } Actions taken: February 28, 2012: received issue January 7, 2013: closed issue Discussion: End of Annotations:===== m: Ed Seidewitz To: "issues@omg.org" Subject: Bug in ForkedToken::withdraw when the baseToken is a ForkedToken Specification: Semantics of a Foundational Subset for Executable UML Models (fUML) (formal/2011-02-01) Subclause: 8.5.2.2.10 ForkedToken ForkedToken::withdraw calls isWithdrawn() to check if its baseToken is withdrawn, and then withdraws it if that is false. The intent is that baseToken.withdraw() only be called once. However, if the baseToken is itself a ForkedToken, then calling withdraw() may only decrement the remainingOffersCount of that token, with isWithdrawn() only becoming true if this count goes to zero. This means that additional calls to withdraw() on the first ForkedToken may result in additional calls to withdraw() on its baseToken, prematurely reducing the remainingOffersCount for the baseToken. This can be avoided by adding an explicit baseTokenIsWithdrawn flag to ForkedToken that is set when the baseToken is withdrawn and then checked to avoid further withdraws.