Skip to main content

How to Overcome Template Clobbering Issues?

Comments

1 comment

  • Owen Wood

    Testing on Jenkins 2.89.1.6, the following:

    <% if (instance != null 
    && instance.item != null 
    && instance.item.getProperties() != null) { %> 
    ${xml(hudson.model.Items.XSTREAM.toXML(instance.item.getProperties()))} 
    <% }

    doesn't work. instance.item.getProperties actually now returns 

    hudson.util.DescribableList

    while type <properties> is expected.

    This can be fixed by changing the previous to:

    <% if (instance != null 
    && instance.item != null 
    && instance.item.getProperties() != null) { %> 
    <properties>
    <% 
    instance.item.getProperties().each { %> ${xml(hudson.model.Items.XSTREAM.toXML(it))}  <% }
    %> 
    </properties>
    <% } 

    Guessing that this has something to do with the changes to Xstream present in more recent versions of Jenkins.

    0

Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.