Prohibit creating two views with the same name.

http://d.hatena.ne.jp/ssogabe/20090101/1230744150

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14067 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-12-31 23:58:43 +00:00
1 parent 17cecbc66b
commit c5a4e8c463
3 files changed
+38 -2

No files matched your search

+4 -1
View File
@@ -531,7 +531,10 @@ public abstract class View extends AbstractModelObject implements AccessControll
public static View create(StaplerRequest req, StaplerResponse rsp, ViewGroup owner) throws ParseException, FormException, IOException, ServletException {
req.setCharacterEncoding("UTF-8");
checkGoodName(req.getParameter("name"));
String name = req.getParameter("name");
checkGoodName(name);
if(owner.getView(name)!=null)
throw new FormException(Messages.Hudson_ViewAlreadyExists(name),"name");
// create a view
View v = LIST.findByName(req.getParameter("mode")).newInstance(req,req.getSubmittedForm());