Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367317

Summary: [editor] XtextDocument should not call IUnitOfWork with null resource
Product: [Modeling] TMF Reporter: Jan Koehnlein <jan>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: karsten.thoms
Version: 2.2.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: v2.8

Description Jan Koehnlein CLA 2011-12-21 08:26:44 EST
In some situations, e.g. when eclipse is restarted with open editors to no longer existing files, the XtextDocument calls IUnitOfWorks with a 'null' state.

Instead of dealing with that condition in all clients, I'd rather not call the IUnitOfWork when there is no resource.
Comment 1 Karsten Thoms CLA 2016-04-13 14:08:39 EDT
An NPE guard was added with #fb09ed5c5be11955772544226a17ca4e878ab053 on 2015-02-16. Considering as fixed.

internalModify(new IUnitOfWork.Void<XtextResource>() {
  @Override
  public void process(XtextResource state) throws Exception {
    // the resource may already be null if the document was opened for a bogus
    // storage / stream - NPE guard here
    if (state != null) { ... }
Comment 2 Eclipse Webmaster CLA 2017-10-31 10:46:33 EDT
Requested via bug 522520.

-M.
Comment 3 Eclipse Webmaster CLA 2017-10-31 10:57:48 EDT
Requested via bug 522520.

-M.