Conversation
- Updated VBehavior::convertToDescription to check for null text before calling "trim()". - Updated VBehavior::triggerToText to handle payload argument with no text.
|
@himi |
himi
left a comment
There was a problem hiding this comment.
The fix is straightforward and if it's urgent to fix, please go ahead. If we have time for this issue, rather I want to introduce expressionToText() even if it's just calling getText() and trim() because it's getting important to render expressions without the original text when we get models via v2 API.
|
@himi |
|
I tried to improve this but I found it involves |
This PR fixes a bug that can cause a null-pointer exception when visualizing a state transition in a model that has been loaded from a repository.
Background
Consider the following simple state model:
This would normally be visualized as

However, if the model is published to a repository and then later loaded back into memory rather than being parsed from text, attempting to visualize it results in a null pointer exception.
Normally, the guard expressions and effect actions are rendered using the textual notation from which they were parsed. However, when the model is loaded from a repository, the original textual notation is no longer available. The exception occurs because the code was attampting to call
trim()on null text strings.Code changes
This PR fixes the bug by updating the code in

VBehavior.convertToDescriptionto check if textual notation strings are null before callingtrim()on them. After this change, the above model, when loaded from a repository, is visualized without an exception as:This is probably the best that can be done for now, without re-serializing the text from the abstract syntax or storing the original text as an annotation in the repository.
Note. The lack of rendering of typing on features in the loaded model is due to the
featuredTypeproperty ofFeatureTypingrelationships not being set properly for the loaded model. This is not a visualization issue.