Skip to content

NullPointerException when selecting Platform and Boards #1681

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

Closed
magic-icicle opened this issue Sep 9, 2024 · 3 comments
Closed

NullPointerException when selecting Platform and Boards #1681

magic-icicle opened this issue Sep 9, 2024 · 3 comments
Labels
OS: all status: Package problem (not a sloeber problem) The problem can not be fixed in sloeber but needs a fix in the used package

Comments

@magic-icicle
Copy link

I added a Third Party Index URL for Sparkfun: "https://raw.githubusercontent.com/sparkfun/Arduino_Boards/main/IDE_Board_Manager/package_sparkfun_index.json"

Whenever I try to select "Sparkfun" from "Platforms and Boards", I get an error. The behaviour is the same as was already reported (and solved?) in Issue #1497.

My environment:

eclipse.buildId=4.32.0.20240606-1231
java.version=21.0.4
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_GB
Framework arguments: -product org.eclipse.epp.package.cpp.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.cpp.product -data /home/user/eclipse-arduino

Stacktrace:

java.lang.NullPointerException: Cannot read the array length because "inScopeVersions" is null at io.sloeber.ui.preferences.PlatformSelectionPage.mustBeInstalled(PlatformSelectionPage.java:61) at io.sloeber.ui.preferences.PlatformSelectionPage$3$1.isChecked(PlatformSelectionPage.java:263) at org.eclipse.jface.viewers.CheckboxTreeViewer.doUpdateItem(CheckboxTreeViewer.java:126) at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:158) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174) at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1073) at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:426) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174) at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2111) at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:894) at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:872) at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:611) at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:819) at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(AbstractTreeViewer.java:1603) at org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeViewer.java:904) at org.eclipse.jface.viewers.AbstractTreeViewer$3.treeExpanded(AbstractTreeViewer.java:1615) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:149) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1617) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1643) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1626) at org.eclipse.swt.widgets.Tree.gtk_test_expand_row(Tree.java:2620) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2624) at org.eclipse.swt.widgets.Display.windowProc(Display.java:6168) at org.eclipse.swt.internal.gtk3.GTK3.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1598) at org.eclipse.swt.internal.gtk3.GTK3.gtk_main_iteration_do(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4514) at org.eclipse.jface.window.Window.runEventLoop(Window.java:823) at org.eclipse.jface.window.Window.open(Window.java:799) at io.sloeber.ui.actions.OpenPreferencesHandler.execute(OpenPreferencesHandler.java:64) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:277) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:98) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:299) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:233) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:174) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:165) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:204) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:444) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:442) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:464) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1617) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5065) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4517) at org.eclipse.jface.window.Window.runEventLoop(Window.java:823) at org.eclipse.jface.window.Window.open(Window.java:799) at org.eclipse.ui.internal.views.log.EventDetailsDialog.open(EventDetailsDialog.java:198) at org.eclipse.ui.internal.views.log.EventDetailsDialogAction.run(EventDetailsDialogAction.java:102) at org.eclipse.ui.internal.views.log.LogView.lambda$2(LogView.java:624) at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:779) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174) at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:776) at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1580) at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1205) at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:271) at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:328) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1617) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5065) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4517) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605) at org.eclipse.equinox.launcher.Main.run(Main.java:1481) at org.eclipse.equinox.launcher.Main.main(Main.java:1454)

@jantje
Copy link
Member

jantje commented Sep 9, 2024

I notice you use
https://raw.githubusercontent.com/sparkfun/Arduino_Boards/main/IDE_Board_Manager/package_sparkfun_index.json
Where the one published on https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls is
https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json

The 2 are clearly different.
Given the fact the same name (package_sparkfun_index.json) is used and my system already has the official one I can not install the "main" easily.
Please try the master.

@jantje
Copy link
Member

jantje commented Sep 9, 2024

I did some digging and I found the problem to be with the sparkfun provided json not being compliant with the arduino framework provided instructions you can find here https://arduino.github.io/arduino-cli/1.0/package_index_json-specification/
image
As you can see below the sparkfun json file contains 2 packages
image
What Sloeber supports (has to for the Arduino provided json) however the 2 packages have the same name (SparkFun)
Sloeber does not like that because the name is considered the ID.
One can discuss whether that is a good idea but the above mentioned specification states
image
Which means that a correctly implemented Arduino framework will install the different SparkFun packages in the same folder (because the packages have the same name) which makes one wonder why to separate them in the first place.

My conclusion is: this is a sparkfun json issue not a Sloeber issue

@magic-icicle
Copy link
Author

The file from the "master"-Link above works as expected. I was using the "main" because it was referenced from the Sparkfun Tutorial.

Thanks a lot for your help!

@jantje jantje closed this as completed Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS: all status: Package problem (not a sloeber problem) The problem can not be fixed in sloeber but needs a fix in the used package
Projects
None yet
Development

No branches or pull requests

2 participants