From 12689f0c306028c933d35a326b4a6afaeaba00a5 Mon Sep 17 00:00:00 2001 From: mindless Date: Fri, 3 Jul 2009 22:04:18 +0000 Subject: [PATCH] [FIXED HUDSON-3674] Don't allow rename of view to same name as another view git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@19389 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/View.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index ec414e1da9..96a4a48af4 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -139,9 +139,11 @@ public abstract class View extends AbstractModelObject implements AccessControll /** * Renames this view. */ - public void rename(String newName) throws ParseException { + public void rename(String newName) throws ParseException, FormException { if(name.equals(newName)) return; // noop checkGoodName(newName); + if(owner.getView(newName)!=null) + throw new FormException(Messages.Hudson_ViewAlreadyExists(newName),"name"); String oldName = name; name = newName; owner.onViewRenamed(this,oldName,newName);