| Summary: | NPE during Xtext validation | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Andreas Muelder <Andreas.Muelder> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | dennis.huebner, jan, sebastian.zarnekow |
| Version: | unspecified | Flags: | sebastian.zarnekow:
indigo+
|
| Target Milestone: | SR1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Andreas Muelder
Cannot reproduce this. Please reopen if this bug reappears. Hi Jan, I reopened because I can reproduce this issue on different machines. Maybe this is a platform dependend problem, do you need log files or something? Greets, Andreas Yes, a log would be helpful, even though this beging to appear a race condition thing. I tried with both, a new project and the domainmodel example on a Mac and everything worked fine. But I remember having seen a similar exception before. Maybe we should just add a NPE guard for a missing annotationModel. If you add a breakpoint in org.eclipse.xtext.ui.editor.validation.AnnotationIssueProcessor.modelChanged(IAnnotationModel) is the passed in model = null or is it the same as the field annotationModel?? Since #getAnnotationsToRemove has this guard
if (monitor.isCanceled() || annotationModel == null) {
return Lists.newArrayList();
}
I'd assume that the annotation model may be null. We should probably move the guard to #processIssues ?
If a grammar file outside the workspace is opened, XtextReadonlyEditorInput is used. This implements IStorageEditorInput instead of IFileEditorInput. Thus, the StorageDocumentProvider is used instead of the FileDocumentProvider and StorageDocumentProvider#createAnnotationModel simply returns null. Thus, null is passed to the constructor of the AnnotationIssueProcessor. I don't know whats the best solution - let XtextReadonlyEditorInput implement IFileEditorInput or add some null checks in the AnnotationIssueProcessor? FInally I could reproduce it: It does not occur if you open a file from the original workspace from a runtime Eclipse, as the folders are linked such that IFiles can be used... To run validation on an editor without an annotation model doesn't make sense, neither does an AnnotationIssueProcessor without annotation model. I added a guard in the XtextDocumentProvider and explicitly throw an exception when someone tries to instantiate an AIP without annotation model. Pushed to MASTER. *** Bug 349990 has been marked as a duplicate of this bug. *** Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |