提交 41f1fe66 编写于 作者: S Seiji Sogabe

[FIXED JENKINS-15836] Slave's Name should be trimmed of spaces at the...

[FIXED JENKINS-15836] Slave's Name should be trimmed of spaces at the beginning and end of the Name on Save
上级 234cd362
......@@ -55,7 +55,10 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=bug>
Slave's Name should be trimmed of spaces at the beginning and end of the Name on Save.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15836">issue 15836</a>)
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -53,6 +53,7 @@ import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.json.JSONObject;
/**
* Serves as the top of {@link Computer}s in the URL hierarchy.
......@@ -262,9 +263,13 @@ public final class ComputerSet extends AbstractModelObject implements Describabl
@QueryParameter String type ) throws IOException, ServletException, FormException {
final Jenkins app = Jenkins.getInstance();
app.checkPermission(Computer.CREATE);
checkName(name);
String fixedName = Util.fixEmptyAndTrim(name);
checkName(fixedName);
Node result = NodeDescriptor.all().find(type).newInstance(req, req.getSubmittedForm());
JSONObject formData = req.getSubmittedForm();
formData.put("name", fixedName);
Node result = NodeDescriptor.all().find(type).newInstance(req, formData);
app.addNode(result);
// take the user back to the slave list top page
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册