-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
CentOS release 6.9 (Final)
openjdk version "1.8.0_131"
Jenkins ver. 2.89.3
Previous URLtrigger Plugin version installed: v0.41. Several jobs defined using "Poll with a URL" work for months until the URLtrigger v0.43 is applied. Jobs attempt to poll on normal (cron) scedule, but in the URLtrigger log I get error, "[ERROR] - Polling error..." and in the Jenkins server log, I get the following.
Jun 12, 2018 11:13:00 AM org.jenkinsci.lib.xtrigger.AbstractTrigger reportError
WARNING: Polling failed
java.lang.NullPointerException
at org.jenkinsci.plugins.urltrigger.URLTrigger.checkIfModifiedEntryForHttpOrHttpsURL(URLTrigger.java:262)
at org.jenkinsci.plugins.urltrigger.URLTrigger.checkIfModifiedEntry(URLTrigger.java:248)
at org.jenkinsci.plugins.urltrigger.URLTrigger.checkIfModified(URLTrigger.java:225)
at org.jenkinsci.lib.xtrigger.AbstractTrigger$Runner.run(AbstractTrigger.java:202)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)
Polling was defined to examine a JSON file and inspect the JSONpath ".BuildNum". Manually editing the job definition to remove and then identically re-define the URL spec makes the polling work again.
Hmm, looks like it's calling .size() on a null object, when it should be either checking for null or checking the true-ness of the value.
https://github.com/jenkinsci/urltrigger-plugin/blob/aec43e370550b26636aa9cab0f23a5cbcffdc44f/src/main/java/org/jenkinsci/plugins/urltrigger/URLTrigger.java#L262
In my case, I'm using the job-dsl plugin, so my workaround was to use the configure block to set 'org.jenkinsci.plugins.urltrigger.URLTrigger' / 'entries' / 'org.jenkinsci.plugins.urltrigger.URLTriggerEntry' / 'requestHeaders' to be empty (instead of missing).