Sauce on Demand plugin version 1.154
We intermittently see a “java.lang.NullPointerException” using Sauce On Demand when running a browser test using a Build Flow as trigger, which causes the tunnel creation to fail, so naturally the browser test never executes. We were never able to reproduce this error when triggering the browser test manually so we added some debug statement to src/main/java/hudson/plugins/sauce_ondemand/SauceEnvironmentUtil.java (https://github.com/imuchnik/sauce-ondemand-plugin) and waited for the problem to resurface. We examined the output log and noticed this:
ERROR outputting environment variable
It appears that in some circumstances browserInstance is null, an NPE is thrown and Sauce On Demand fails to create a tunnel and the Jenkins job subsequently fails.
We have the environmental variables output inside a try/catch block starting here (https://github.com/imuchnik/sauce-ondemand-plugin/blob/30dd383db64398f5980f6f37689bfd0d6ba08cca/src/main/java/hudson/plugins/sauce_ondemand/SauceEnvironmentUtil.java#L67) and we allow the job to continue even though browserInstance is null, as it appears that if we catch and swallow the NPE the browser test executes without problem from that point forward.