| Summary: | Potential NPE in AttributedPosition#createStyleRange() | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Karsten Thoms <karsten.thoms> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | knut.wannheden, sebastian.zarnekow |
| Version: | 2.0.1 | Flags: | sebastian.zarnekow:
juno+
|
| Target Milestone: | M4 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Karsten Thoms
Not 2.1 FWIW I've come across this problem as well: org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at org.eclipse.swt.SWT.error(SWT.java:4282) at org.eclipse.swt.SWT.error(SWT.java:4197) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410) at org.eclipse.equinox.launcher.Main.main(Main.java:1386) Caused by: java.lang.NullPointerException at org.eclipse.xtext.ui.editor.syntaxcoloring.AttributedPosition.createStyleRange(AttributedPosition.java:48) at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingPresenter.applyTextPresentation(HighlightingPresenter.java:604) at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4877) at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingPresenter.updatePresentation(HighlightingPresenter.java:488) at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingPresenter$1.run(HighlightingPresenter.java:370) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135) ... 23 more Karsten, can you provide some more informatione, e.g. which language the code templates belong to and how the code snippet looked like? I am getting this one in my Spray Runtime workspace. git clone https://code.google.com/a/eclipselabs.org/p/spray/ tag "bug357176" Reproduce: - open Preferences -> Spray -> Templates - select template "Line" The NPE occurs for me when selecting this template (In reply to comment #4) > I am getting this one in my Spray Runtime workspace. > > git clone https://code.google.com/a/eclipselabs.org/p/spray/ > tag "bug357176" > > Reproduce: > - open Preferences -> Spray -> Templates > - select template "Line" > > The NPE occurs for me when selecting this template Does the problem persist if you disable the layout_id token style, e.g. by replacing it by the default keyword style? I think you meant in SprayHighlightingConfiguration#configure I have commented out all custom code here. The error still remains. I was refering to the token colorer. I have now checked this. The NPE does disappears when the SprayTokenToAttributeIdMapper#calculateId() does not return LAYOUT_ID
protected String calculateId(String tokenName, int tokenType) {
if (layoutKeywords.contains(tokenName)) {
return SprayHighlightingConfiguration.LAYOUT_ID;
}
return super.calculateId(tokenName, tokenType);
}
When I comment out the if block the error does not appear.
Pushed a NPE guard to master. Custom highlighting styles don't work at the moment for the template configuration. Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |