function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jorg_JankeJorg_Janke 

Force.com IDE NullPointerException when trying to run test - old code?

Environment:
- Eclipse Neon 4.6.1 (Mac)
- Force.com IDE 37.0.0.201609220436
- following the install instructions and using https://developer.salesforce.com/media/force-ide/eclipse45

When creating a new Run Configuration, I 
- click on the new Icon 
- select a Force.com project
- click on the "Test" tab - the Search for the test class is grayed out

An error has occurred. See error log for more details.
java.lang.NullPointerException

In the log:
Message: Unhandled event loop exception
java.lang.NullPointerException
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.lambda$1(ApexSourceUtils.java:293)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.filterSourcesByType(ApexSourceUtils.java:294)
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.filterSourcesByClass(ApexSourceUtils.java:243)
    at com.salesforce.ide.apex.internal.core.ApexSourceUtils.findTestClassesInProject(ApexSourceUtils.java:67)
    at com.salesforce.ide.ui.views.runtest.TestConfigurationsBuilder.buildTestsForProject(TestConfigurationsBuilder.java:59)
    at com.salesforce.ide.ui.views.runtest.TestConfigurationTab.buildTestsForProject(TestConfigurationTab.java:505)
    at com.salesforce.ide.ui.views.runtest.TestConfigurationTab.initializeFrom(TestConfigurationTab.java:591)
    at org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup.initializeFrom(AbstractLaunchConfigurationTabGroup.java:90)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupWrapper.initializeFrom(LaunchConfigurationTabGroupWrapper.java:201)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.handleRevertPressed(LaunchConfigurationTabGroupViewer.java:1443)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$3.getConfirmation(LaunchConfigurationsDialog.java:610)
    at org.eclipse.debug.internal.ui.launchConfigurations.AbstractLaunchConfigurationAction.run(AbstractLaunchConfigurationAction.java:97)
    at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
    at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:436)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:818)
    at org.eclipse.jface.window.Window.open(Window.java:794)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(LaunchConfigurationsDialog.java:1203)
    at org.eclipse.debug.ui.DebugUITools$3.run(DebugUITools.java:629)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:637)
    at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:570)
    at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:82)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
    at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:687)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:604)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1519)

I checked the code https://github.com/forcedotcom/idecore/blob/a78d00e17e729cb688faa8369564b51c6e81d9f5/com.salesforce.ide.apex.core/src/com/salesforce/ide/apex/internal/core/ApexSourceUtils.java

it is not the current/latest version - it was changed Jun 16, 2016 and uses the code before then.

Seems to me that the code is 37.0 - i.e. Spring 16
How do I install Winter 16??

As a result, I cannot run any tests in Eclipse.
SandhyaSandhya (Salesforce Developers) 
Hi Jorg_Janke,

Try to update your Eclipse clicking on help and also most of the people who encountered this got solved by restarting the Eclipse see if that helps you.

Please refer below link for latest update.

https://developer.salesforce.com/page/Force.com_IDE_Release_Notes

Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution.
 

Thanks and Regards
Sandhya


 
Jorg_JankeJorg_Janke
... installed it on a new box - with the repository location in the release notes (same as above) ... and the only option is version 37...
User-added image
Jorg_JankeJorg_Janke
... uups sorry 37.0 is Summer and with that the latest version available - so the NullPointer happens in the current version, which uses a version of the offending class which was updated after the release.

... so the question is if there is a workaround for the error.
Charles DouCharles Dou
I am having the exact problem with v38.0 as well. Have any one figured out why?
Jorg_JankeJorg_Janke
... no - my "solution" was to re-install.  It seems to me that after a while, the cache gets corrupted. 
Charles DouCharles Dou
I've already tried to re-install a couple of times. I also down-grade it to v36 but the same issue still happens. I start thinking if something is wrong on my computer. I have eclipse neon.3 release 4.6.3 and java version 8 update 121 on my windows 7 computer.