package com.codicesoftware.plugins.hudson.util;

import hudson.Util;
import hudson.model.ParameterValue;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class SelectorParametersResolver {

    public static String resolve(String text, List<ParameterValue> parameters) {
        if (parameters == null) {
            return text;
        }

        Map<String, String> parametersMap = new HashMap<>();
        for (ParameterValue parameter : parameters) {
            if ((parameter != null) && (parameter.getName() != null) && (parameter.getValue() != null)) {
                parametersMap.put(parameter.getName(), parameter.getValue().toString());
            }
        }

        return Util.replaceMacro(text, parametersMap);
    }
}

@@ -760,28 +760,405 @@
 cro(
-text, parametersMap)
+%0D%0A            resolveLegacyFormat(text, parametersMap), parametersMap);%0D%0A    %7D%0D%0A%0D%0A    static String resolveLegacyFormat(String text, Map%3CString, String%3E parametersMap) %7B%0D%0A        String result = text;%0D%0A        for (Map.Entry%3CString, String%3E entry : parametersMap.entrySet()) %7B%0D%0A            result = result.replaceAll(%22%25%22 + entry.getKey() + %22%25%22, entry.getValue());%0D%0A        %7D%0D%0A        return result
 ;%0D%0A 

Make parameter resolution backwards compatible