Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » NPE during serializing(NPE in PreferenceStoreWhitespaceInformationProvider.getLineSeparatorPreference(PreferenceStoreWhitespaceInformationProvider.java:56) when calling Serializer.serialize(Serializer.java:51))
icon4.gif  NPE during serializing [message #890410] Fri, 22 June 2012 08:52 Go to next message
Tobias Böhm is currently offline Tobias BöhmFriend
Messages: 21
Registered: January 2012
Junior Member
Good day,

I have a plugin that containes 3 Xtext grammars and lets the user enter text in an EmbeddedEditor. The problem that occures on some machines now, is that for two of the three grammars, serialization of the entered text will result in a NullPointerException.

The stacktrace is the following:

!ENTRY org.eclipselabs.recommenders.codesearch.rcp 4 0 2012-06-22 09:44:31.831
!MESSAGE Error while searching. Query was: * * (java.lang.String, java.util.List)
!STACK 0
java.lang.NullPointerException
at org.eclipse.xtext.ui.editor.formatting.PreferenceStoreWhitespaceInformationProvider.getLineSeparatorPreference(PreferenceStoreWhitespaceInformationProvider.java:56)
at org.eclipse.xtext.ui.editor.formatting.PreferenceStoreWhitespaceInformationProvider.getLineSeparatorInformation(PreferenceStoreWhitespaceInformationProvider.java:46)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.getLineSeparatorInfo(AbstractDeclarativeFormatter.java:114)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.createFormattingConfig(AbstractDeclarativeFormatter.java:81)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.getConfig(AbstractDeclarativeFormatter.java:92)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.createFormatterStream(AbstractDeclarativeFormatter.java:75)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:103)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:122)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:51)

at org.eclipse.recommenders.codesearch.rcp.searcher.AbstractQLSearcher.serializeLuceneQuery(AbstractQLSearcher.java:40)
at org.eclipse.recommenders.codesearch.rcp.searcher.MethodPatternQLSearcher.search(MethodPatternQLSearcher.java:50)
at org.eclipse.recommenders.internal.codesearch.rcp.views.MethodPatternQLEditorWrapper.search(MethodPatternQLEditorWrapper.java:95)
at org.eclipse.recommenders.internal.codesearch.rcp.views.SearchQueryView$8.runInWorkspace(SearchQueryView.java:390)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


The weird thing is that it doesn't happen on every machine so I guess, but please correct me if I'm wrong, the problem is dependant on the installed Xtext version but it's the exact same update site that my plug-in is installed from that is what confuses me.

I found this bug: bugs.eclipse.org/bugs/show_bug.cgi?id=380406 and it contains the same stacktrace and says that the problem might be grammars that have multiple entry points. The first, always working grammar, is an expression syntax which I guess has multiple entry points but again, this is the one working 100% of the time. The other two, non working, grammars have multiple entry points too. If that would solve the problem, is there a way I can define a rule as the sole entry point for a grammar?

Are there any other things I could check?

Thanks in advance,
Tobias

Re: NPE during serializing [message #890436 is a reply to message #890410] Fri, 22 June 2012 09:49 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias BöhmFriend
Messages: 21
Registered: January 2012
Junior Member
FYI: My runtime has Xtext installed in version 2.2.1
The runtime where the problem occurs has Xtext installed in version 2.3
Re: NPE during serializing [message #892737 is a reply to message #890436] Fri, 29 June 2012 12:16 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias BöhmFriend
Messages: 21
Registered: January 2012
Junior Member
Is there something obvious that I'm missing or did I give too little information?
Re: NPE during serializing [message #892738 is a reply to message #892737] Fri, 29 June 2012 12:17 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias BöhmFriend
Messages: 21
Registered: January 2012
Junior Member
It is now happening on our build server too while testing:

testNegativeCase(org.eclipselabs.recommenders.test.codesearch.rcp.dslQL2.VariableIdentityTest) Time elapsed: 0.36 sec <<< ERROR!
java.lang.NullPointerException
at org.eclipse.xtext.ui.editor.formatting.PreferenceStoreWhitespaceInformationProvider.getLineSeparatorPreference(PreferenceStoreWhitespaceInformationProvider.java:56)
at org.eclipse.xtext.ui.editor.formatting.PreferenceStoreWhitespaceInformationProvider.getLineSeparatorInformation(PreferenceStoreWhitespaceInformationProvider.java:46)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.getLineSeparatorInfo(AbstractDeclarativeFormatter.java:114)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.createFormattingConfig(AbstractDeclarativeFormatter.java:81)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.getConfig(AbstractDeclarativeFormatter.java:92)
at org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.createFormatterStream(AbstractDeclarativeFormatter.java:75)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:103)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:122)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:51)
at org.eclipse.recommenders.codesearch.rcp.searcher.AbstractQLSearcher.serializeLuceneQuery(AbstractQLSearcher.java:40)
at org.eclipse.recommenders.codesearch.rcp.searcher.CodeSnippetQLSearcher.search(CodeSnippetQLSearcher.java:59)
at org.eclipselabs.recommenders.test.codesearch.rcp.dslQL2.VariableIdentityTest.testNegativeCase(VariableIdentityTest.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:72)
at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:31)
at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:114)
at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:37)
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:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
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)


I would really appreciate any help.
Thanks,Tobi
Re: NPE during serializing [message #892946 is a reply to message #892737] Mon, 02 July 2012 06:26 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 2961
Registered: July 2009
Senior Member
Looks like you try to serialize a resource that does not have a URI.
That's pretty much of an violated invariant.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 29.06.12 14:16, schrieb Tobias Böhm:
> Is there something obvious that I'm missing or did I give too little
> information?
Re: NPE during serializing [message #892954 is a reply to message #892738] Mon, 02 July 2012 07:11 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 658
Registered: July 2009
Senior Member
1) Does your build server run Eclipse? The
PreferenceStoreWhitespaceInformationProvider should only be bound in the
UI module, i.e. for the Equinox run scenario.

2) Code recommenders seems to kick in for a resource that has no URI
set. Maybe you have to set a URI in in the resources you create in your
tests.

Am 29.06.12 14:17, schrieb Tobias Böhm:
> It is now happening on our build server too while testing:
>
> testNegativeCase(org.eclipselabs.recommenders.test.codesearch.rcp.dslQL2.VariableIdentityTest)
> Time elapsed: 0.36 sec <<< ERROR!
> java.lang.NullPointerException
> at
> org.eclipse.xtext.ui.editor.formatting.PreferenceStoreWhitespaceInformationProvider.getLineSeparatorPreference(PreferenceStoreWhitespaceInformationProvider.java:56)
>
> at
> org.eclipse.xtext.ui.editor.formatting.PreferenceStoreWhitespaceInformationProvider.getLineSeparatorInformation(PreferenceStoreWhitespaceInformationProvider.java:46)
>
> at
> org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.getLineSeparatorInfo(AbstractDeclarativeFormatter.java:114)
>
> at
> org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.createFormattingConfig(AbstractDeclarativeFormatter.java:81)
>
> at
> org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.getConfig(AbstractDeclarativeFormatter.java:92)
>
> at
> org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter.createFormatterStream(AbstractDeclarativeFormatter.java:75)
>
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:103)
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:122)
> at
> org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:51)
> at
> org.eclipse.recommenders.codesearch.rcp.searcher.AbstractQLSearcher.serializeLuceneQuery(AbstractQLSearcher.java:40)
>
> at
> org.eclipse.recommenders.codesearch.rcp.searcher.CodeSnippetQLSearcher.search(CodeSnippetQLSearcher.java:59)
>
> at
> org.eclipselabs.recommenders.test.codesearch.rcp.dslQL2.VariableIdentityTest.testNegativeCase(VariableIdentityTest.java:56)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:616)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
> at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>
> at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>
> at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> at
> org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:72)
>
> at
> org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
>
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
>
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
>
> at
> org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:31)
>
> at
> org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:114)
>
> at
> org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:37)
>
> 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:353)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:616)
> 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)
>
>
> I would really appreciate any help.
> Thanks,Tobi


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: NPE during serializing [message #899346 is a reply to message #890410] Tue, 31 July 2012 14:10 Go to previous messageGo to next message
Joey Mink is currently offline Joey MinkFriend
Messages: 87
Registered: July 2009
Location: Centreville, VA, USA
Member

Tobias - were you able to resolve this. I am finding the same NullPointerException when serializing, but only occasionally. I'm currently working with Xtext 2.0.1.
Re: NPE during serializing [message #899352 is a reply to message #890410] Tue, 31 July 2012 14:10 Go to previous message
Joey Mink is currently offline Joey MinkFriend
Messages: 87
Registered: July 2009
Location: Centreville, VA, USA
Member

Tobias - were you able to resolve this. I am finding the same NullPointerException when serializing, but only occasionally. I'm currently working with Xtext 2.0.1.
Previous Topic:Outline Tree Provider
Next Topic:interdependence between your Ecore and your Grammar(editor)
Goto Forum:
  


Current Time: Fri Dec 19 20:31:04 GMT 2014

Powered by FUDForum. Page generated in 0.09113 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software