[JIRA] [email-ext-plugin] (JENKINS-32090) NullPointerException when processing email template when JDKs are installed automatically

6 views
Skip to first unread message

jeffekhardt@yahoo.com (JIRA)

unread,
Dec 15, 2015, 6:06:01 PM12/15/15
to jenkinsc...@googlegroups.com
Jeff Ekhardt created an issue
 
Jenkins / Bug JENKINS-32090
NullPointerException when processing email template when JDKs are installed automatically
Issue Type: Bug Bug
Assignee: Alex Earl
Components: email-ext-plugin
Created: 15/Dec/15 11:05 PM
Environment: Jenkins ver. 1.609.3
Email Extension Plugin 2.40.5
Linux ip-172-31-45-225 3.14.44-32.39.amzn1.x86_64 #1 SMP Thu Jun 11 20:33:38 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Priority: Critical Critical
Reporter: Jeff Ekhardt

When a specific Java version is selected in a Maven Project and that Java version is configured to automatically install, there is a NullPointerException thrown related to using build.getEnvironment(listener) in email ext templates. This causes data loss in the reports related to environment variables.

The exception from the jenkins log is:

Dec 15, 2015 1:34:59 PM org.apache.commons.jelly.expression.jexl.JexlExpression evaluate
WARNING: Caught exception evaluating: build.getEnvironment(listener). Reason: java.lang.NullPointerException
java.lang.NullPointerException
        at hudson.tools.JDKInstaller.performInstallation(JDKInstaller.java:119)
        at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
        at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:107)
        at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:205)
        at hudson.model.JDK.forNode(JDK.java:130)
        at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:355)
        at hudson.model.Run.getEnvironment(Run.java:2228)
        at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:932)
        at hudson.maven.AbstractMavenBuild.getEnvironment(AbstractMavenBuild.java:56)
        at hudson.maven.MavenModuleSetBuild.getEnvironment(MavenModuleSetBuild.java:166)
        at sun.reflect.GeneratedMethodAccessor1371.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:258)
        at org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:104)
        at org.apache.commons.jexl.parser.ASTReference.execute(ASTReference.java:83)
        at org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:57)
        at org.apache.commons.jexl.parser.ASTReferenceExpression.value(ASTReferenceExpression.java:51)
        at org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:80)
        at org.apache.commons.jelly.expression.jexl.JexlExpression.evaluate(JexlExpression.java:69)
        at org.apache.commons.jelly.tags.core.CoreTagLibrary$3.run(CoreTagLibrary.java:134)
        at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
        at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:161)
        at org.apache.commons.jelly.impl.StaticTag.doTag(StaticTag.java:65)
        at org.apache.commons.jelly.impl.StaticTagScript.run(StaticTagScript.java:124)
        at org.apache.commons.jelly.tags.core.CoreTagLibrary$2.run(CoreTagLibrary.java:105)
        at hudson.plugins.emailext.plugins.content.JellyScriptContent.convert(JellyScriptContent.java:82)
        at hudson.plugins.emailext.plugins.content.JellyScriptContent.renderContent(JellyScriptContent.java:73)
        at hudson.plugins.emailext.plugins.content.JellyScriptContent.evaluate(JellyScriptContent.java:48)
        at org.jenkinsci.plugins.tokenmacro.DataBoundTokenMacro.evaluate(DataBoundTokenMacro.java:190)
        at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:191)
        at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:246)
        at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:71)
        at hudson.plugins.emailext.ExtendedEmailPublisher.addContent(ExtendedEmailPublisher.java:671)
        at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:550)
        at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:331)
        at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:322)
        at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:230)
        at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:776)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
        at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.cleanUp(MavenModuleSetBuild.java:1071)
        at hudson.model.Run.execute(Run.java:1785)
        at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
        at hudson.model.ResourceController.execute(ResourceController.java:98)
        at hudson.model.Executor.run(Executor.java:381)

The code in the jelly template is:

<j:set var="envVars" value="${build.getEnvironment(listener)}" />
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

slide.o.mix@gmail.com (JIRA)

unread,
Dec 15, 2015, 6:08:03 PM12/15/15
to jenkinsc...@googlegroups.com

slide.o.mix@gmail.com (JIRA)

unread,
Dec 15, 2015, 6:08:03 PM12/15/15
to jenkinsc...@googlegroups.com

slide.o.mix@gmail.com (JIRA)

unread,
Dec 15, 2015, 6:09:02 PM12/15/15
to jenkinsc...@googlegroups.com

slide.o.mix@gmail.com (JIRA)

unread,
Dec 15, 2015, 6:09:02 PM12/15/15
to jenkinsc...@googlegroups.com

dbeck@cloudbees.com (JIRA)

unread,
Dec 16, 2015, 11:18:01 AM12/16/15
to jenkinsc...@googlegroups.com
Daniel Beck resolved as Not A Defect
 

It helps to not pass a null argument.

Change By: Daniel Beck
Status: Open Resolved
Resolution: Not A Defect

slide.o.mix@gmail.com (JIRA)

unread,
Dec 16, 2015, 11:32:03 AM12/16/15
to jenkinsc...@googlegroups.com

dbeck@cloudbees.com (JIRA)

unread,
Dec 16, 2015, 11:38:02 AM12/16/15
to jenkinsc...@googlegroups.com

It throws on this line. Everything else in the stack trace just passes on the argument received here.

slide.o.mix@gmail.com (JIRA)

unread,
Dec 16, 2015, 11:51:01 AM12/16/15
to jenkinsc...@googlegroups.com

Listener is provided in the context by email-ext, but it shouldn't be null since it comes from the build.

dbeck@cloudbees.com (JIRA)

unread,
Dec 16, 2015, 11:53:01 AM12/16/15
to jenkinsc...@googlegroups.com

Further debugging should probably be done in the template. Is it possible user customization unset the var or something?

slide.o.mix@gmail.com (JIRA)

unread,
Dec 16, 2015, 12:02:06 PM12/16/15
to jenkinsc...@googlegroups.com
Alex Earl reopened an issue
 
Change By: Alex Earl
Resolution: Not A Defect
Status: Resolved Reopened

slide.o.mix@gmail.com (JIRA)

unread,
Dec 16, 2015, 12:04:01 PM12/16/15
to jenkinsc...@googlegroups.com

slide.o.mix@gmail.com (JIRA)

unread,
Dec 16, 2015, 12:08:02 PM12/16/15
to jenkinsc...@googlegroups.com
Alex Earl commented on Bug JENKINS-32090
 
Re: NullPointerException when processing email template when JDKs are installed automatically

My mistake, the context provides a logger, not listener. So, the user does need to update the template to retrieve the listener from the build instead of using "listener" as the parameter. Jelly sets to null anything it can't find in the context as far as I can tell.

slide.o.mix@gmail.com (JIRA)

unread,
Dec 16, 2015, 12:09:02 PM12/16/15
to jenkinsc...@googlegroups.com
Alex Earl resolved as Not A Defect
 
Change By: Alex Earl
Status: Reopened Resolved
Resolution: Not A Defect
Reply all
Reply to author
Forward
0 new messages