While testing refactoring, a NPE is received occasionally. Below is a snipped from the stack trace.
However, the cause of this bug implies an even more critical issue. The bug occurs when the user tries to edit a "live" xtext document and the refactoring processor isn't able to retrieve the element via an xtext resource set using the live scope. The reason this occurs is that under some circumstances, the DirtyStateManager may not contain the dirty state of a resource. This results in the version in the file being used.
It is plausible that under some circumstances, the editor would potentially retrieve an incorrect model resource via the URI and refactor it. I am unaware of other cases this may affect. The editor doesn't use live scoped xtext resource sets or the built-in dirty state manager at this time so the damage is relatively limited. However, in the future, the editor should likely use the built-in capability of xtext.
The issue appears to be in xtext.
Steps to reproduce
Make whitespace change to text editor.
Save. This results in a markEditorClean/discardDirtyState. State is now should_update.
Switch to graphical editor and create a subcomponent. This results in a announceDirtyStateChanged() which attempts to replace. Doesn't add element because replace...
Reproduce issue in an Xtext unit test.
Report issue to xtext developers.
The text was updated successfully, but these errors were encountered:
Another work around is being added soon to DefaultAadlModificationService. The workaround will call doVerify() on the editor's dirty state editor support to ensure that the dirty state from the editor is being managed.