continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1660690 - in /continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/admin/ConfigurationAction.java resources/localization/Continuum.properties
Date Wed, 18 Feb 2015 17:39:01 GMT
Author: batkinson
Date: Wed Feb 18 17:39:00 2015
New Revision: 1660690

URL: http://svn.apache.org/r1660690
Log:
Added filesystem validation for configured directories.

Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigurationAction.java
    continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigurationAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigurationAction.java?rev=1660690&r1=1660689&r2=1660690&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigurationAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigurationAction.java
Wed Feb 18 17:39:00 2015
@@ -75,18 +75,21 @@ public class ConfigurationAction
         if ( workingDirectoryFile != null )
         {
             workingDirectory = workingDirectoryFile.getAbsolutePath();
+            validateDir( "workingDirectory", workingDirectoryFile );
         }
 
         File buildOutputDirectoryFile = configuration.getBuildOutputDirectory();
         if ( buildOutputDirectoryFile != null )
         {
             buildOutputDirectory = buildOutputDirectoryFile.getAbsolutePath();
+            validateDir( "buildOutputDirectory", buildOutputDirectoryFile );
         }
 
         File deploymentRepositoryDirectoryFile = configuration.getDeploymentRepositoryDirectory();
         if ( deploymentRepositoryDirectoryFile != null )
         {
             deploymentRepositoryDirectory = deploymentRepositoryDirectoryFile.getAbsolutePath();
+            validateDir( "deploymentRepositoryDirectory", deploymentRepositoryDirectoryFile
);
         }
 
         baseUrl = configuration.getUrl();
@@ -103,6 +106,7 @@ public class ConfigurationAction
         if ( releaseOutputDirectoryFile != null )
         {
             releaseOutputDirectory = releaseOutputDirectoryFile.getAbsolutePath();
+            validateDir( "releaseOutputDirectory", releaseOutputDirectoryFile );
         }
 
         numberOfAllowedBuildsinParallel = configuration.getNumberOfBuildsInParallel();
@@ -188,6 +192,21 @@ public class ConfigurationAction
         return SUCCESS;
     }
 
+    private void validateDir( String fieldName, File dir )
+    {
+        if ( dir.exists() )
+        {
+            if ( !dir.isDirectory() )
+            {
+                addFieldError( fieldName, getText( "configuration.dir.notdir" ) );
+            }
+            if ( !dir.canWrite() )
+            {
+                addFieldError( fieldName, getText( "configuration.dir.notwritable" ) );
+            }
+        }
+    }
+
     public String getWorkingDirectory()
     {
         return workingDirectory;

Modified: continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=1660690&r1=1660689&r2=1660690&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Wed Feb 18 17:39:00 2015
@@ -281,6 +281,8 @@ configuration.numberOfBuildsInParallel.i
 configuration.distributedBuildEnabled.label = Enable Distributed Builds
 configuration.sharedSecretPassword.label = Shared Secret Password
 configuration.sharedSecretPassword.message = Enter the shared secret password between master
and agents when distributed build is enabled
+configuration.dir.notdir=Location not a directory
+configuration.dir.notwritable=Directory not writable
 
 # ----------------------------------------------------------------------
 # Page: Add Project



Mime
View raw message