提交 a4bb1638 编写于 作者: K kohsuke

Fixed a possible NPE in <tt>Hudson.removeNode</tt>

    (<a href="http://www.nabble.com/problems-adding-deleting-nodes-p24999793.html">report</a>)


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20812 71c3de6d-444a-0410-be80-ed276b4c234a
上级 e9aec7b4
......@@ -87,6 +87,7 @@ import hudson.slaves.Cloud;
import hudson.slaves.DumbSlave;
import hudson.slaves.NodeDescriptor;
import hudson.slaves.NodeProvisioner;
import hudson.slaves.OfflineCause;
import hudson.tasks.BuildWrapper;
import hudson.tasks.Builder;
import hudson.tasks.DynamicLabeler;
......@@ -1373,7 +1374,9 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
* Removes a {@link Node} from Hudson.
*/
public synchronized void removeNode(Node n) throws IOException {
n.toComputer().disconnect();
Computer c = n.toComputer();
if (c!=null)
c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved()));
ArrayList<Node> nl = new ArrayList<Node>(this.slaves);
nl.remove(n);
......
......@@ -78,6 +78,7 @@ Hudson.JobAlreadyExists=A job already exists with the name ''{0}''
Hudson.NoJavaInPath=java is not in your PATH. Maybe you need to <a href=''{0}/configure''>configure JDKs</a>?
Hudson.NoName=No name is specified
Hudson.NoSuchDirectory=No such directory: {0}
Hudson.NodeBeingRemoved=Node is being removed
Hudson.NotADirectory={0} is not a directory
Hudson.NotAPlugin={0} is not a Hudson plugin
Hudson.NotJDKDir={0} doesn''t look like a JDK directory
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册