Bug #4547
closeddocumentation for file parameter includes an error
0%
Description
The documentation for the file parameter includes at the top:
Error evaluating DocAttribute parameter: ptolemy.kernel.util.IllegalActionException: Error evaluating expression:
and at the bottom:
in .Unnamed1.FileParameter. .description Because: The ID ID is undefined.
Updated by ben leinfelder almost 15 years ago
also in StringParameter.
It's not in the actor moml...so it must be in the action that is displaying the documentation
Updated by ben leinfelder almost 15 years ago
Parsing the description is throwing an error - perhaps it's trying to substitute values or $ID?
Snippet from the FileParameter.xml MOML below:
<p>The FileParameter specifies a file or URL. The value of the parameter is a string that may contain references to variables within scope (i.e., variables defined at the same level of the hierarchy or higher) using the $ID ${ID}, or $(ID) syntax. </p>
Updated by Christopher Brooks almost 15 years ago
Viewing the documentation for FileParameter works fine in the ptII tree,
but fails in Kepler, probably because of something about the Kepler customizations to the documentation viewer.
However, if I modify ptolemy/vergil/actor/DocManager.java to include the
stack trace:
_exception = "Error evaluating DocAttribute parameter:\n" + e
+ ptolemy.kernel.util.KernelException.stackTraceToString(e);
Then I get the stack trace below, which does not include a call to
ptolemy/ptolemy/vergil/basic/KeplerDocumentationAttribute.java
Looking at the code, I see that DocAttribute has description as a StringParameter.
I think this should be changed to a StringAttribute so that the contents
of the description are not evaluated and so that $ID is not expanded.
I made this change in my tree and found it was necessary to add a MoMLFilter
for this change because the configuration has files that
ptolemy/configs/basicUtilities.xml include lines like:
<property name="description" class="ptolemy.data.expr.StringParameter" value="To edit the documentation that appears when the user double clicks on this icon, right click on the background of the model and select Documentation->Customize Documentation. The description you are currently editing will not appear when the user double clicks on the Documentation icon.">
The MoMLFilter looks for DocAttributes and changes the class of
description from StringParameter to StringAttribute.
The question is: should this change go in to the Ptolemy tree, or is
the problem really in Kepler?
I think the description should be a StringAttribute, not a StringParameter.
However, this change would require updating many files because the filter
would mark the files as modified.
Anyway, here's the stack trace from Kepler
ptolemy.data.expr.Variable._evaluate(Variable.java:1656) at ptolemy.data.expr.Variable.getToken(Variable.java:578) at ptolemy.data.expr.StringParameter.stringValue(StringParameter.java:95) at ptolemy.vergil.actor.DocManager. (DocManager.java:164) at ptolemy.vergil.actor.DocViewer._init(DocViewer.java:652) at ptolemy.vergil.actor.DocViewer. (DocViewer.java:115) at ptolemy.vergil.actor.DocTableau. (DocTableau.java:90) at ptolemy.vergil.basic.GetDocumentationAction.showDocAttributeTableau(GetDocumentationAction.java:442) at ptolemy.vergil.basic.GetDocumentationAction.showDocumentation(GetDocumentationAction.java:161) at ptolemy.vergil.basic.GetDocumentationAction.actionPerformed(GetDocumentationAction.java:120) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258) at javax.swing.AbstractButton.doClick(AbstractButton.java:334) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1050) at apple.laf.CUIAquaMenuItem.doClick(CUIAquaMenuItem.java:119) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1091) at java.awt.Component.processMouseEvent(Component.java:5602) at javax.swing.JComponent.processMouseEvent(JComponent.java:3129) at java.awt.Component.processEvent(Component.java:5367) at java.awt.Container.processEvent(Container.java:2010) at java.awt.Component.dispatchEventImpl(Component.java:4068) at java.awt.Container.dispatchEventImpl(Container.java:2068) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866) at java.awt.Container.dispatchEventImpl(Container.java:2054) at java.awt.Window.dispatchEventImpl(Window.java:1801) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110) Caused by: ptolemy.data.expr.UndefinedConstantOrIdentifierException: The ID ID is undefined. at ptolemy.data.expr.ParseTreeEvaluator.visitLeafNode(ParseTreeEvaluator.java:674) at ptolemy.data.expr.ASTPtLeafNode.visit(ASTPtLeafNode.java:125) at ptolemy.data.expr.ParseTreeEvaluator._evaluateChild(ParseTreeEvaluator.java:1310) at ptolemy.data.expr.ParseTreeEvaluator._evaluateAllChildren(ParseTreeEvaluator.java:1264) at ptolemy.data.expr.ParseTreeEvaluator.visitSumNode(ParseTreeEvaluator.java:1116) at ptolemy.data.expr.ASTPtSumNode.visit(ASTPtSumNode.java:128) at ptolemy.data.expr.ParseTreeEvaluator.evaluateParseTree(ParseTreeEvaluator.java:104) at ptolemy.data.expr.Variable._evaluate(Variable.java:1644) ... 36 more Caused by: ptolemy.data.expr.UndefinedConstantOrIdentifierException: The ID ID is undefined. at ptolemy.data.expr.ParseTreeEvaluator.visitLeafNode(ParseTreeEvaluator.java:674) at ptolemy.data.expr.ASTPtLeafNode.visit(ASTPtLeafNode.java:125) at ptolemy.data.expr.ParseTreeEvaluator._evaluateChild(ParseTreeEvaluator.java:1310) at ptolemy.data.expr.ParseTreeEvaluator._evaluateAllChildren(ParseTreeEvaluator.java:1264) at ptolemy.data.expr.ParseTreeEvaluator.visitSumNode(ParseTreeEvaluator.java:1116) at ptolemy.data.expr.ASTPtSumNode.visit(ASTPtSumNode.java:128) at ptolemy.data.expr.ParseTreeEvaluator.evaluateParseTree(ParseTreeEvaluator.java:104) at ptolemy.data.expr.Variable._evaluate(Variable.java:1644) at ptolemy.data.expr.Variable.getToken(Variable.java:578) at ptolemy.data.expr.StringParameter.stringValue(StringParameter.java:95) at ptolemy.vergil.actor.DocManager. (DocManager.java:164) at ptolemy.vergil.actor.DocViewer._init(DocViewer.java:652) at ptolemy.vergil.actor.DocViewer. (DocViewer.java:115) at ptolemy.vergil.actor.DocTableau. (DocTableau.java:90) at ptolemy.vergil.basic.GetDocumentationAction.showDocAttributeTableau(GetDocumentationAction.java:442) at ptolemy.vergil.basic.GetDocumentationAction.showDocumentation(GetDocumentationAction.java:161) at ptolemy.vergil.basic.GetDocumentationAction.actionPerformed(GetDocumentationAction.java:120) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258) at javax.swing.AbstractButton.doClick(AbstractButton.java:334) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1050) at apple.laf.CUIAquaMenuItem.doClick(CUIAquaMenuItem.java:119) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1091) at java.awt.Component.processMouseEvent(Component.java:5602) at javax.swing.JComponent.processMouseEvent(JComponent.java:3129) at java.awt.Component.processEvent(Component.java:5367) at java.awt.Container.processEvent(Container.java:2010) at java.awt.Component.dispatchEventImpl(Component.java:4068) at java.awt.Container.dispatchEventImpl(Container.java:2068) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866) at java.awt.Container.dispatchEventImpl(Container.java:2054) at java.awt.Window.dispatchEventImpl(Window.java:1801) at java.awt.Component.dispatchEvent(Component.java:3903) at java.awt.EventQueue.dispatchEvent(EventQueue.java:463) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176) at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Updated by Christopher Brooks almost 15 years ago
Fixed. Changed DocAttribute.description from a StringParameter to a StringAttribute so that Kepler does not report errors when displaying documentation. It is unclear why this fails for Kepler, but works for Ptolemy. An addition to moml.filter.PropertyClassChanges filters for this change. Fortunately, only three demos required changes.
ptolemy/domains/de/demo/Clock/Clock.xml
ptolemy/domains/modal/demo/Case/Case.xml
ptolemy/actor/lib/hoc/demo/Case/Case.xml
The changed Java files were:
ptolemy/vergil/basic/KeplerDocumentationAttribute.java
ptolemy/vergil/basic/DocAttribute.java
ptolemy/vergil/actor/DocManager.java
ptolemy/moml/filter/PropertyClassChanges.java
Note that this change means that models that have DocAttributes with the
description parameter set will be marked as modified by the filter.
Thus, the user will be prompted for save on close.