continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r654980 - in /continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/AddProjectAction.java resources/org/apache/maven/continuum/web/action/AddProjectAction.properties
Date Fri, 09 May 2008 23:42:17 GMT
Author: olamy
Date: Fri May  9 16:42:17 2008
New Revision: 654980

URL: http://svn.apache.org/viewvc?rev=654980&view=rev
Log:
[CONTINUUM-1701] No field validation when adding Ant and Shell projects
Submitted by Jevica Arianne B. Zurbano


Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
    continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/AddProjectAction.properties

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?rev=654980&r1=654979&r2=654980&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
Fri May  9 16:42:17 2008
@@ -88,16 +88,19 @@
         boolean projectNameAlreadyExist = false;
 
         clearErrorsAndMessages();
+        
         try
         {
+            if ( ( projectName.trim().length() > 0 ) && ( projectVersion.trim().length()
> 0 ) && ( projectScmUrl.trim().length() > 0 ) )
+            {
             Iterator<Project> projects = getContinuum().getProjects().iterator();
             while ( projects.hasNext() )
             {
                 Project project = projects.next();
                 // CONTINUUM-1445
-                if ( StringUtils.equalsIgnoreCase( project.getName(), projectName ) &&
-                    StringUtils.equalsIgnoreCase( project.getVersion(), projectVersion )
&&
-                    StringUtils.equalsIgnoreCase( project.getScmUrl(), projectScmUrl ) )
+                if ( StringUtils.equalsIgnoreCase( project.getName(), projectName.trim()
) &&
+                    StringUtils.equalsIgnoreCase( project.getVersion(), projectVersion.trim()
) &&
+                    StringUtils.equalsIgnoreCase( project.getScmUrl(), projectScmUrl.trim()
) )
                 {
                     projectNameAlreadyExist = true;
                     break;
@@ -108,6 +111,23 @@
                 addActionError( "projectName.already.exist.error" );
                 this.input();
             }
+            }
+            else
+            {
+                if ( !( projectName.trim().length() > 0 ) )
+                {
+                    addActionError( getText( "addProject.name.required" ) );
+                }
+                if ( !( projectVersion.trim().length() > 0 ) )
+                {
+                    addActionError( getText( "addProject.version.required" ) );
+                }
+                if ( !( projectScmUrl.trim().length() > 0 ) )
+                {
+                    addActionError( getText( "addProject.scmUrl.required" ) );
+                }
+                this.input();
+            }
         }
         catch ( ContinuumException e )
         {
@@ -143,11 +163,11 @@
 
         Project project = new Project();
 
-        project.setName( projectName );
+        project.setName( projectName.trim() );
 
-        project.setVersion( projectVersion );
+        project.setVersion( projectVersion.trim() );
 
-        project.setScmUrl( projectScmUrl );
+        project.setScmUrl( projectScmUrl.trim() );
 
         project.setScmUsername( projectScmUsername );
 

Modified: continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/AddProjectAction.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/AddProjectAction.properties?rev=654980&r1=654979&r2=654980&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/AddProjectAction.properties
(original)
+++ continuum/trunk/continuum-webapp/src/main/resources/org/apache/maven/continuum/web/action/AddProjectAction.properties
Fri May  9 16:42:17 2008
@@ -17,6 +17,6 @@
 # under the License.
 #
 
-addProject.name.required = Name is required and cannot contain spaces only
-addProject.version.required = Version is required and cannot contain spaces only
-addProject.scmUrl.required = SCM Url is required and cannot contain spaces only
+addProject.name.required = Name is required and cannot contain null or spaces only
+addProject.version.required = Version is required and cannot contain null or spaces only
+addProject.scmUrl.required = SCM Url is required and cannot contain null or spaces only



Mime
View raw message