Skip to content

Commit

Permalink
[FIXED JENKINS-17401] Behave gracefully if the user tries to rename a…
Browse files Browse the repository at this point in the history
… job using the Apply button.
  • Loading branch information
jglick committed Dec 23, 2013
1 parent 9f23c0b commit 9e5817a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/main/java/hudson/model/Job.java
Expand Up @@ -54,6 +54,7 @@
import hudson.util.FormApply;
import hudson.util.Graph;
import hudson.util.ProcessTree;
import hudson.util.QuotedStringTokenizer;
import hudson.util.RunList;
import hudson.util.ShiftedCategoryAxis;
import hudson.util.StackedAreaRenderer2;
Expand Down Expand Up @@ -1144,7 +1145,11 @@ public synchronized void doConfigSubmit(StaplerRequest req,
// check this error early to avoid HTTP response splitting.
Jenkins.checkGoodName(newName);
namingStrategy.checkName(newName);
rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
if (FormApply.isApply(req)) {
FormApply.applyResponse("notificationBar.show(" + QuotedStringTokenizer.quote(Messages.Job_you_must_use_the_save_button_if_you_wish()) + ",notificationBar.WARNING)").generateResponse(req, rsp, null);
} else {
rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
}
} else {
if(namingStrategy.isForceExistingJobs()){
namingStrategy.checkName(name);
Expand Down
1 change: 1 addition & 0 deletions core/src/main/resources/hudson/model/Messages.properties
Expand Up @@ -182,6 +182,7 @@ Job.NoRecentBuildFailed=No recent builds failed.
Job.Pronoun=Project
Job.minutes=mins

Job.you_must_use_the_save_button_if_you_wish=You must use the Save button if you wish to rename a job.
Label.GroupOf=group of {0}
Label.InvalidLabel=invalid label
Label.ProvisionedFrom=Provisioned from {0}
Expand Down

0 comments on commit 9e5817a

Please sign in to comment.