提交 c0dca145 编写于 作者: K kohsuke

improved the robustness in case of failed rename (issue #1662)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9106 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5166e6f3
......@@ -359,7 +359,9 @@ public abstract class Job<JobT extends Job<JobT,RunT>, RunT extends Run<JobT,Run
doSetName(newName);
File newRoot = this.getRootDir();
{// rename data files
boolean success = false;
try {// rename data files
boolean interrupted=false;
boolean renamed = false;
......@@ -406,6 +408,12 @@ public abstract class Job<JobT extends Job<JobT,RunT>, RunT extends Run<JobT,Run
e.printStackTrace();
}
}
success = true;
} finally {
// if failed, back out the rename.
if(!success)
doSetName(oldName);
}
parent.onRenamed((TopLevelItem)this,oldName,newName);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册