Use TextParameterValue instead of String

If a value with a newline is received, Jenkins does not display the
value correctly in the parameters page.  Based on a quick reading
of similar issues elsewhere, it may also not save the value correctly
for later use by plugins such as the 'rebuild' plugin.  Switching
from string to text parameter types solves this.  However, it does
cause _all_ parameters to be treated as text, which wastes a bit of
real-estate on the parameters listing screen with tall textboxes.
We could scan the string for '\n' and choose appropriately as an
alternative.

Change-Id: I84ef198fd6ef852fc0a403e126f13b8cbb58a7b1
This commit is contained in:
James E. Blair 2014-07-02 16:54:15 -07:00
parent 6961c9d441
commit b37c6a2789
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ import hudson.model.Cause;
import hudson.model.Computer;
import hudson.model.Hudson;
import hudson.model.Queue;
import hudson.model.StringParameterValue;
import hudson.model.TextParameterValue;
import hudson.model.queue.QueueTaskFuture;
import hudson.slaves.OfflineCause;
@ -141,7 +141,7 @@ public class StartJobWorker extends AbstractGearmanFunction {
}.getType());
// set build parameters that were passed in from client
for (Map.Entry<String, String> entry : inParams.entrySet()) {
buildParams.add(new StringParameterValue(entry.getKey(), entry.getValue()));
buildParams.add(new TextParameterValue(entry.getKey(), entry.getValue()));
}
String offline = inParams.get("OFFLINE_NODE_WHEN_COMPLETE");
if (offline != null) {