Uploaded image for project: 'Magnolia Webhooks'
  1. Magnolia Webhooks
  2. MGNLHOOK-267

NullPointerException when empty events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • None

      When creating a webhook definition with empty events, there will be a NullPointerException. There is also NullPointerException when changing other content types.

      Ex:

      name: webhook1
      url: https://httpdump.io/ne_sz
      method: get
      enabled: true
      
      events: 

      Note: there is no exception if we don't define "events"

      2022-10-28 14:14:00,498 INFO  onfiguration.RestClientRegistryConfigurationSource: Registered Rest Client definition from Webhook definition [webhook-mgnlhook-201:webhookConfig_1]: [restClient] definition [webhook-mgnlhook-201:webhookConfig_1] with reference id: [webhook-mgnlhook-201:webhookConfig_1] from module [webhooks-core] at [webhook-mgnlhook-201:webhookConfig_1]
      2022-10-28 14:14:00,504 ERROR info.magnolia.event.SimpleEventBus                : Exception caught when dispatching info.magnolia.webhooks.core.WebhookDefinitionChangedEvent with info.magnolia.webhooks.registry.WebhookDefinitionEventHandler eventHandler.
      java.lang.NullPointerException: null
          at info.magnolia.webhooks.registry.WebhookDefinitionEventHandler.onChange(WebhookDefinitionEventHandler.java:68) ~[magnolia-webhooks-core-1.0.1-SNAPSHOT.jar:?]
          at info.magnolia.webhooks.core.WebhookDefinitionChangedEvent.dispatch(WebhookDefinitionChangedEvent.java:57) ~[magnolia-webhooks-core-1.0.1-SNAPSHOT.jar:?]
          at info.magnolia.webhooks.core.WebhookDefinitionChangedEvent.dispatch(WebhookDefinitionChangedEvent.java:28) ~[magnolia-webhooks-core-1.0.1-SNAPSHOT.jar:?]
          at info.magnolia.event.SimpleEventBus.fireEvent(SimpleEventBus.java:75) ~[magnolia-core-6.2-SNAPSHOT.jar:?]
          at info.magnolia.webhooks.registry.WebhookDefinitionRegistry.register(WebhookDefinitionRegistry.java:92) ~[magnolia-webhooks-core-1.0.1-SNAPSHOT.jar:?]
          at info.magnolia.config.source.yaml.YamlConfigurationSource.loadAndRegister(YamlConfigurationSource.java:143) ~[magnolia-configuration-6.2-SNAPSHOT.jar:?]
          at info.magnolia.config.source.yaml.AbstractFileResourceConfigurationSource.lambda$start$2(AbstractFileResourceConfigurationSource.java:162) ~[magnolia-configuration-6.2-SNAPSHOT.jar:?]
          at info.magnolia.resourceloader.layered.LayeredResourceOrigin$RelayingChangeHandler.onResourceChanged(LayeredResourceOrigin.java:284) ~[magnolia-resource-loader-6.2-SNAPSHOT.jar:?]
          at info.magnolia.resourceloader.AbstractResourceOrigin.dispatchResourceChange(AbstractResourceOrigin.java:132) ~[magnolia-resource-loader-6.2-SNAPSHOT.jar:?]
          at info.magnolia.resourceloader.file.FileWatcherCallback.dispatchResourceChange(FileWatcherCallback.java:118) ~[magnolia-resource-loader-6.2-SNAPSHOT.jar:?]
          at info.magnolia.resourceloader.file.FileWatcherCallback.modified(FileWatcherCallback.java:89) ~[magnolia-resource-loader-6.2-SNAPSHOT.jar:?]
          at info.magnolia.dirwatch.DirectoryWatcher.processEvent(DirectoryWatcher.java:303) ~[magnolia-resource-loader-6.2-SNAPSHOT.jar:?]
          at info.magnolia.dirwatch.DirectoryWatcher.run(DirectoryWatcher.java:247) ~[magnolia-resource-loader-6.2-SNAPSHOT.jar:?]
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
          at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
          at java.lang.Thread.run(Thread.java:829) ~[?:?]
      2022-10-28 14:14:00,537 INFO  agnolia.config.source.yaml.YamlConfigurationSource: Registered definition from YAML file [/mgnlhook-201/webhooks/webhookConfig_1.yaml]: [webhook] definition [webhook1] with reference id: [mgnlhook-201:webhookConfig_1] from module [mgnlhook-201] at [webhookConfig_1]
      2022-10-28 14:14:00,537 WARN  agnolia.config.source.yaml.YamlConfigurationSource: 0 major and 1 minor problems have been encountered
       

        Acceptance criteria

              Unassigned Unassigned
              plequoc Phong Le Quoc
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: