Variable substitution fails with NumberFormatException

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

If you are using a Bamboo variable to populate a script or function that expects a numerical value, but the Bamboo variable is not correctly referenced, the following will appear in the job log

 Can't assign value '${variable}' to attribute <name>, reason: class java.lang.NumberFormatException with message 'For input string: "${variable}"

Cause

Bamboo variables need to have bamboo prepended to the variable name when passed to Tasks, for example

variable = ${bamboo.variable_name}

instead of 

variable = ${variable_name}

 

If the identifier bamboo is not added, Bamboo will read this as a string, and not substitute the variable.

 

Resolution

Please ensure that the variable is correctly passed as ${bamboo.variable_name}.

 

Last modified on Mar 8, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.