All of them should prevent the deletion of the meta-data, preson, or meta-data group object in the case the quantity is set to 1m or +. The behaviour can be overriden by setting the boolean parameter force to true. However, the syntax of the if checks misses the required negation, turning the function to behave just the opposite (only checking for 1m or + in case force is true). I wondered why nobody ever noticed, and found out that the function is always only called from another delegate function,
removeMetadata(Metadata)
removePerson(Person)
removeMetadataGroup(MetadataGroup)
with force set to false. Thus the checks never apply. Code can be refactored to
incorporate the code part not circumvented by the always-false parameter into the one-parameter remove functions
The class
DocStruct
provides the three methodsremoveMetadata(Metadata, boolean)
removePerson(Person, boolean)
removeMetadataGroup(MetadataGroup, boolean)
All of them should prevent the deletion of the meta-data, preson, or meta-data group object in the case the quantity is set to
1m
or+
. The behaviour can be overriden by setting the boolean parameterforce
totrue
. However, the syntax of theif
checks misses the required negation, turning the function to behave just the opposite (only checking for1m
or+
in caseforce
istrue
). I wondered why nobody ever noticed, and found out that the function is always only called from another delegate function,removeMetadata(Metadata)
removePerson(Person)
removeMetadataGroup(MetadataGroup)
with
force
set tofalse
. Thus the checks never apply. Code can be refactored tofalse
parameter into the one-parameter remove functions