ARM-software / cmsis-pack-eclipse

CMSIS-Pack Eclipse Plug-ins
Other
66 stars 32 forks source link

NPE in CpPackManager.processPackAdded() when installing first Pack into empty CMSIS root folder #44

Closed JohnKBartholomew closed 9 months ago

JohnKBartholomew commented 7 years ago

We just found this in the 2.2.0 release - here's how to reproduce it:

Eclipse Neon.3 with CMSIS Pack release 2.2.0 installed. Set your CMSIS root folder to a valid location, but a directory that is empty. Open the CMSIS Pack Manager perspective. Install a Pack.

I get a NullPointerException at CpPackManager.ProcessPackAdded() line 668: allPacks.addChild(pack); as allPacks in null at this point. We are working on integrating the CMSIS Pack feature into our product. While we can likely work around this issues, it can result in the NPE being visible to users...

Traceback is: java.lang.NullPointerException at com.arm.cmsis.pack.CpPackManager.processPackAdded(CpPackManager.java:668) at com.arm.cmsis.pack.CpPackManager.processPackAdded(CpPackManager.java:658) at com.arm.cmsis.pack.CpPackManager.processPackJob(CpPackManager.java:624) at com.arm.cmsis.pack.CpPackManager.handle(CpPackManager.java:613) at com.arm.cmsis.pack.CpPackManager.handle(CpPackManager.java:1) at com.arm.cmsis.pack.generic.GenericListenerList.notifyListeners(GenericListenerList.java:51) at com.arm.cmsis.pack.events.RteEventProxy.emitRteEvent(RteEventProxy.java:23) at com.arm.cmsis.pack.CpPlugIn.emitRteEvent(CpPlugIn.java:219) at com.arm.cmsis.pack.installer.CpPackInstaller.jobFinished(CpPackInstaller.java:473) at com.arm.cmsis.pack.installer.jobs.CpPackUnpackJob.run(CpPackUnpackJob.java:98) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

soares-sergio commented 5 years ago

Hi, I found this same issue a couple days ago. I made some changes to fix it (and also to reload the local packs after offline installation). See attached commit. I submitted a pull request as well.

Regards, Sergio.