continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r446933 - in /maven/continuum/branches/continuum-acegi/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/AddProjectAction.java resources/localization/Continuum.properties webapp/addProject.jsp
Date Sat, 16 Sep 2006 20:09:00 GMT
Author: carlos
Date: Sat Sep 16 13:08:59 2006
New Revision: 446933

URL: http://svn.apache.org/viewvc?view=rev&rev=446933
Log:
[CONTINUUM-864] Adding a project with a name that already exist causes internal error

Modified:
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/addProject.jsp

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?view=diff&rev=446933&r1=446932&r2=446933
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
Sat Sep 16 13:08:59 2006
@@ -29,6 +29,7 @@
  */
 public class AddProjectAction
     extends ContinuumActionSupport
+    implements Validateable
 {
 
     private String projectName;
@@ -44,6 +45,38 @@
     private String projectScmTag;
 
     private String projectType;
+
+    public void validate()
+        throws ContinuumException
+    {
+        boolean projectNameAlreadyExist = false;
+        Iterator iterator;
+        Project project;
+
+        clearErrorsAndMessages();
+        try
+        {
+            iterator = getContinuum().getProjects().iterator();
+            while ( iterator.hasNext() )
+            {
+                project = (Project) iterator.next();
+                if ( project.getName().equalsIgnoreCase( projectName ) )
+                {
+                    projectNameAlreadyExist = true;
+                    break;
+                }
+            }
+            if ( projectNameAlreadyExist == true )
+            {
+                addActionError( "projectName.already.exist.error" );
+            }
+        }
+        catch ( ContinuumException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
 
     public String execute()
         throws ContinuumException

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/localization/Continuum.properties?view=diff&rev=446933&r1=446932&r2=446933
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/localization/Continuum.properties
Sat Sep 16 13:08:59 2006
@@ -14,6 +14,7 @@
 delete = Delete
 save = Save
 add = Add
+back = Back
 workingCopy = Working Copy
 builds = Builds
 info = Info
@@ -143,6 +144,7 @@
 
 projectName.label = Project Name
 projectName.error = You must provide a project name
+projectName.already.exist.error = Project name already exist
 projectName.message = Enter the project name
 
 projectScm.label = Scm
@@ -233,6 +235,7 @@
 buildDefinition.arguments.label = Arguments
 buildDefinition.defaultForProject.label = Is it default?
 buildDefinition.schedule.label = Schedule
+buildDefinition.save.error.message = There was an error updating the schedule...either no
schedule name was supplied or a schedule with the same name already exists.
 
 # ----------------------------------------------------------------------
 # Page: DeleteBuildDefinition

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/addProject.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/addProject.jsp?view=diff&rev=446933&r1=446932&r2=446933
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/addProject.jsp
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/addProject.jsp
Sat Sep 16 13:08:59 2006
@@ -1,5 +1,6 @@
 <%@ taglib uri="/webwork" prefix="ww" %>
 <%@ taglib uri="continuum" prefix="c1" %>
+<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
 <ww:i18n name="localization.Continuum">
 <html>
     <head>
@@ -25,6 +26,13 @@
                 </h3>
                 <div class="axial">
                     <ww:form method="post" action="addProject.action">
+                        <c:if test="${!empty actionErrors}">
+                          <div class="errormessage">
+                            <c:forEach items="${actionErrors}" var="actionError">
+                              <p><ww:text name="${actionError}"/></p>
+                            </c:forEach>
+                          </div>
+                        </c:if>
                         <input type="hidden" name="projectType" value="<ww:property
value="projectType"/>">
                         <table>
                           <tbody>



Mime
View raw message