Closed cxbrooks closed 11 years ago
Thanks to Hogan, D. (GE Energy) for pointing this out:
After setting the input field 'Type' in the 'Configure Ports'-panel to "" (empty) and hitting the 'Commit' button, a MoML change request is issued that looks like this: '
This request is parsed by the MoMLParser and accordingly, the attribute is removed from the MoML representation. However, unlike a regular type change where elementName.equals("property") (see MoMLParser:3099) rather than a removal where elementName.equals("deleteProperty") (see MoMLParser:2490), the running model doesn't get notified that the previous type is now invalid.
Note that upon a regular property change MoMLParser.startElement() calls _handlePropertyElement(), which then adds the parameter to _paramsToParse after which it is retrieved in handler.endDocument() which then calls param.validate().
If the input field is set to "", the attribute only gets removed from the MoML representation, but the model is unaware of this. Currently, the old type persists. The only way to overcome this problem is to (save and) re-open the model, which forces Virgel to entirely parse the MoML description and build up the model from scratch, which will set the type in question to UNKNOWN.
The desired behavior would be that the requested type changes immediately to UNKNOWN.
As a quick fix I added on PortConfigurerDialog.java:582
if (tableValue.equals("")) { tiop.setTypeEquals(BaseType.UNKNOWN); }
This bypasses the MoMLParser and sets the type directly. The behavior is now as desired, but in the end it might be better to adapt the parser itself.
Here's my post to ptolemy-hackers. I think there is a bug in that Manager.resolveTypes() is failing to redo type resolution
--start--
I took a look at the ptolemy/actor/gui/PortConfigurerDialog.java and it looks like when I use the dialog to change the type from double to nothing, then the following moml request is issued:
Created attachment 48 ModelThatFailsToTypeCheckAfterChangingPortType
Attached file: foo_test.moml (application/xml, 4269 bytes) Description: ModelThatFailsToTypeCheckAfterChangingPortType
Could not reproduce; changing the type of RecordDisassembler.foo into double and then running the model results in a double output, then removing the type annotation and running the model again results in the original integer output. This looks like something that I ran into and fixed earlier, not being aware of this ticket. Considering this problem fixed.
I can't reproduce this, I believe it was fixed.
Note: the issue was created automatically with bugzilla2github tool
Original bug ID: BZ#518 From: @lhstrh Reported version: 9.1.devel CC: pt-dev@chess.eecs.berkeley.edu