Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException while running JUnit Plug-in Test on tools.vitruv.applications.pcmjava.seffstatements.tests.ejbtransformations and tools.vitruv.applications.pcmjava.seffstatements.tests.pojotransformations #2

Open
ichupakhin opened this issue Apr 16, 2020 · 1 comment

Comments

@ichupakhin
Copy link
Contributor

java.lang.NullPointerException while running JUnit Plug-in Test on
tools.vitruv.applications.pcmjava.seffstatements.tests.ejbtransformations and
tools.vitruv.applications.pcmjava.seffstatements.tests.pojotransformations:

The method "public void visit(final ChangeClassifyingEventExtension changeClassifyingEvent)" from Class "tools.vitruv.domains.java.monitoreditor.ChangeResponder"
calls get(..) and then visit(..) on the Map "dispatcher", but the Map is empty, what causes a NullPointerException.

Console output:
java.lang.NullPointerException
at tools.vitruv.domains.java.monitorededitor.ChangeResponder.visit(ChangeResponder.java:129)
at tools.vitruv.domains.java.monitorededitor.methodchange.events.ChangeClassifiyingEventExtensionBase.accept(ChangeClassifiyingEventExtensionBase.java:45)
at tools.vitruv.domains.java.monitorededitor.MonitoredEditor.update(MonitoredEditor.java:209)
at tools.vitruv.domains.java.monitorededitor.astchangelistener.ASTChangeListener.notifyAll(ASTChangeListener.java:231)
at tools.vitruv.domains.java.monitorededitor.astchangelistener.ASTChangeListener.notifyAll(ASTChangeListener.java:225)
at tools.vitruv.domains.java.monitorededitor.astchangelistener.ASTChangeListener.elementChanged(ASTChangeListener.java:181)
at org.eclipse.jdt.internal.core.DeltaProcessor$3.run(DeltaProcessor.java:1755)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.internal.core.DeltaProcessor.notifyListeners(DeltaProcessor.java:1743)
at org.eclipse.jdt.internal.core.DeltaProcessor.fireReconcileDelta(DeltaProcessor.java:1594)
at org.eclipse.jdt.internal.core.DeltaProcessor.fire(DeltaProcessor.java:1553)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:777)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802)
at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1315)
at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1274)
at tools.vitruv.applications.pcmjava.tests.util.CompilationUnitManipulatorHelper.editCompilationUnit(CompilationUnitManipulatorHelper.java:38)
at tools.vitruv.applications.pcmjava.seffstatements.tests.pojotransformations.IncrementalSeffReconstructionTest.editMethod(IncrementalSeffReconstructionTest.java:327)
at tools.vitruv.applications.pcmjava.seffstatements.tests.pojotransformations.IncrementalSeffReconstructionTest.editWebGUIDownloadMethod(IncrementalSeffReconstructionTest.java:315)
at tools.vitruv.applications.pcmjava.seffstatements.tests.pojotransformations.IncrementalSeffReconstructionTest.testAddIfStatementContainingExternalCall(IncrementalSeffReconstructionTest.java:143)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:171)
at org.eclipse.pde.internal.junit.runtime.PlatformUITestHarness.lambda$0(PlatformUITestHarness.java:45)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3963)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3590)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.runApp(NonUIThreadTestApplication.java:55)
at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:46)
at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:49)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

@ichupakhin
Copy link
Contributor Author

The problem is faulty extention points ids:
1)point ID: changeeventextendedvisitors in /tools.vitruv.domains.java.monitorededitor/schema/changeeventextendedvisitors.exsd
2)point ID: postchange in /tools.vitruv.domains.java.monitorededitor.astchangelistener/schema
/postchange .exsd
3)point ID: postreconcile in /tools.vitruv.domains.java.monitorededitor.astchangelistener/schema
/postreconcile.exsd

An extention point id must contain at least one dot "." . Else the method org.eclipse.core.internal.registry.ExtensionRegistry.getConfigurationElementsFor(String) will return a new IConfigurationElement[] instead of one existing and therefore no extentions will be found in the method tools.vitruv.framework.util.bridges.EclipseBridge.getRegisteredExtensions(String, String, Class). Hence the map tools.vitruv.domains.java.monitorededitor.ChangeResponder.dispatcher will be empty.
Possible solution:
use as extention point ID: plugin ID + "." + simpleName. For example: "tools.vitruv.domains.java.monitorededitor" + "." + "changeeventextendedvisitors"
TODO:
Rename/change extention points in
/tools.vitruv.domains.java.monitorededitor
/tools.vitruv.domains.java.monitorededitor.astchangelistener
and corresponding extentions in
/tools.vitruv.domains.java.monitorededitor.methodchange
Also adapt the method tools.vitruv.domains.java.monitorededitor.ChangeResponder.fillDispatcherMap() according to the changed extention point id. For example:
private void fillDispatcherMap() {
for (final ChangeEventExtendedVisitor visitor : getRegisteredVisitors(
"tools.vitruv.domains.java.monitorededitor.changeeventextendedvisitors" ) {
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant