hectorespert / nb-native-notifications

Apache Netbeans modules to support native notifications
Apache License 2.0
6 stars 1 forks source link

NPE due to not bundled images #42

Closed jkovalsky closed 2 months ago

jkovalsky commented 2 months ago

The linux-2.0.0.nbm build of the NetBeans Native Notifications plugin [1] does not work and throws NullPointerException instead: [1] https://plugins.netbeans.apache.org/catalogue/?id=42

java.lang.NullPointerException: The image parameter cannot be null
    at org.openide.util.Parameters.notNull(Parameters.java:64)
    at org.openide.util.ImageUtilities.assignToolTipToImageInternal(ImageUtilities.java:397)
    at org.openide.util.ImageUtilities.image2Icon(ImageUtilities.java:328)
    at es.blackleg.nb.notifications.quote.ErrorRandomNotificationAction.actionPerformed(ErrorRandomNotificationAction.java:45)

Looking at the code and into the NBM file it seems like the reason are missing image files:

44        Image image = ImageUtilities.loadImage("org/netbeans/modules/notifications/resources/notificationsError.png");
45        NotificationDisplayer.getDefault().notify("Chuck Norris fact", ImageUtilities.image2Icon(image), faker.chuckNorris().fact(), null, NotificationDisplayer.Priority.HIGH, NotificationDisplayer.Category.ERROR);

Tested on 2.0.0 version of the plugin in Apache NetBeans 21 RC2:

Product Version: Apache NetBeans IDE 21-rc2 Updates: Updates available Java: 21.0.1; Java HotSpot(TM) 64-Bit Server VM 21.0.1+12-LTS-29 Runtime: Java(TM) SE Runtime Environment 21.0.1+12-LTS-29 System: Linux version 5.15.0-102-generic running on amd64; UTF-8; cs_CZ (nb)

hectorespert commented 2 months ago

Hi @jkovalsky

Did you have the notifications module activated?

Thanks for review this plugin

jkovalsky commented 2 months ago

Did you have the notifications module activated?

I believe I had. @hectorespert Are not you able to reproduce the problem?

hectorespert commented 2 months ago

I've managed to reproduce it disabling the notifications module.

I'm going to release a new version to try to fix it.