Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

curly bracket in a var in a groovy script #3447

eranb ·
Sorry for the confusing title <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->

I'm triggering a configuration from a step and I want to set a variable value via "Variables" field.
I set this variable with the value of another variable from another build. The problem is that these value sometimes have a closing curly brackets and the step fail due to syntax issues.

For example,
${groovy:otherBuild.getVarValue["DataXml"]}
If otherBuild.getVarValue["DataXml"] has a closing curly brackets in it, the step will fail.

How do I pass this limitation?

Thanks in advance
  • replies 3
  • views 2427
  • stars 0
robinshen ADMIN ·
Please use below syntax:
${groovy:otherBuild.getVarValue("DataXml")}

It works even if value of DataXml contains closing curly brackets.
eranb ·
Please ignore the square brackets. It was just a typo.
I used a regular brackets in my code and it failed.

an example for the DataXml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<List>
<Items>
<Item>
<Host>${PlatformIp}</Host>
</item>
</items>
</List>
robinshen ADMIN ·
You may not use the form ${PlatformIp} in variable value as it will be interpretated by QB as another script interpolation. To workaround the issue, you may store the Hex encoded form of the XML string to variable, and decode the Hex string when using it.