Menu

#831 Issues with DatatypeHelper.computeId

3.10
open
None
5
2024-06-07
2024-06-07
No

There are several problems with DatatypeHelper.computeId.
First, it is not protected against concurrent access: if several threads create datatypes, there could be a race condition on uniqueId.
Second, the generated id is not guaranteed to be unique. It is made by appending a unique number to the provided name, but the name could end with a number. For example, if the first call is computeId("List1"), the generated id would be "List10" (since uniqueId starts at 0); then, if the eleventh call is computeId("List"), the generated id would be "List10" too (since uniqueId would be equal to 10 at this point). A way to avoid these possible clashes would be to add a separator character that is not allowed in user-provided identifiers.

Discussion


Log in to post a comment.