Project

General

Profile

Bug #3984

RequireVersion parameter cannot be deleted from a saved workflow

Added by Oliver Soong about 10 years ago. Updated about 10 years ago.

Status:
Resolved
Priority:
Normal
Category:
actors
Target version:
Start date:
04/14/2009
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
3984

Description

In an unsaved workflow (no associated file), RequireVersion can be added and deleted as expected. If I save an entirely empty workflow to a file, I can add RequireVersion but cannot delete it. The URL is an example workflow.

History

#1 Updated by Christopher Brooks about 10 years ago

This bug is replicatable in a non-Kepler Ptolemy installation.
File -> New -> Graph Editor
Drag in a RequireVersion attribute
Save the model
The RequireVersion attribute cannot be deleted in the model.

BTW - when creating bugs, it is best to not include example models as URLs
because the URLs tend to disappear over time. If the model is added as an
attachment to the bug, then the model will be more closely associated with
the bug.

#2 Updated by Christopher Brooks about 10 years ago

Fixed!
The problem was that it was not possible to delete a RequireVersion Attribute
from a saved model. One could argue that this is good, since the RequireVersion
attribute is a precondition for the operation of the model. However, software
that tries to be too smart is annoying, and the reason that RequireVersion
could not be deleted is because of a bug, not because of intentional design.

The reason is because VersionAttribute.equals() matches on the version
expression. Thus, if we had a VersionAttribute that had the value 8.0.beta
and a RequireVersion that had the value 8.0.beta, then they were seen as being equal.

What happens is that when we read the model in, we have
VersionAttribute - which is in every model
RequireVersion - which is added by the user

When we delete RequireVersion, the equals() finds first VersionAttribute
at the top and probably deletes it.
The reason this only fails in a saved .xml file is that upon writing the
model is when the VersionAttribute is added.

The fix/workaround is to add equals(Object) and hashCode() to RequireVersion.

#3 Updated by Redmine Admin about 6 years ago

Original Bugzilla ID was 3984

Also available in: Atom PDF