KocproZ / jenkins-discord

A post-build plugin that sends the build status to a Discord channel.
MIT License
39 stars 36 forks source link

Upgrade to 1.3.0 - error when compiling #31

Closed mTrax- closed 5 years ago

mTrax- commented 6 years ago

Hi,

After upgrading to 1.3.0, I have this error when compiling. Any clue ?

Cheers, G.

Java.lang.NullPointerException
    at nz.co.jammehcow.jenkinsdiscord.WebhookPublisher.perform(WebhookPublisher.java:94)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
    at hudson.model.Build$BuildExecution.cleanUp(Build.java:196)
    at hudson.model.Run.execute(Run.java:1862)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Build step 'Discord Notifier' marked build as failure
KocproZ commented 6 years ago

I couldn't reproduce this issue. Can you go into webhook configuraton and set/change the Title and then try again?

aveao commented 6 years ago

Can repro, testing with title.

aveao commented 6 years ago

Works, but why is this a problem that's happening now and why didn't it happen before? It should really be fixed.

KocproZ commented 6 years ago

When adding functionality to this plugin new variables were added to WebhookPublisher. While they are set in a constructor, Jenkins calls the constructor only when changes to project's configuration are made. It means that when plugin is updated, but project's configuration isn't changed, the new variables are null when they shouldn't.

Changing the project configuration is a workaround, because it forces Jenkins to call the WebhookPublisher constructor.

aveao commented 6 years ago

Wouldn't it make sense to have default values so that the plugin doesn't die when values are inputted as null?