[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
This commit is contained in:
mindless committed 2009-07-03 22:04:18 +00:00
1 parent ca0b6e830d
commit 12689f0c30
1 file changed
+3 -1
+3 -1
View File
@@ -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);