continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r484614 - in /maven/continuum/trunk: continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/test/resources/org/apache/maven/continuum/ continuum-we...
Date Fri, 08 Dec 2006 14:14:02 GMT
Author: evenisse
Date: Fri Dec  8 06:14:01 2006
New Revision: 484614

URL: http://svn.apache.org/viewvc?view=rev&rev=484614
Log:
Reactivate allowed protocol validator

Modified:
    maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
    maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties

Modified: maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java?view=diff&rev=484614&r1=484613&r2=484614
==============================================================================
--- maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
(original)
+++ maven/continuum/trunk/continuum-api/src/main/java/org/apache/maven/continuum/project/builder/ContinuumProjectBuildingResult.java
Fri Dec  8 06:14:01 2006
@@ -70,6 +70,8 @@
 
     public static final String ERROR_UNAUTHORIZED = "add.project.unauthorized.error";
 
+    public static final String ERROR_PROTOCOL_NOT_ALLOWED = "add.project.validation.protocol.not_allowed";
+
     public static final String ERROR_ARTIFACT_NOT_FOUND = "add.project.artifact.not.found.error";
 
     public static final String ERROR_PROJECT_BUILDING = "add.project.project.building.error";

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?view=diff&rev=484614&r1=484613&r2=484614
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Fri Dec  8 06:14:01 2006
@@ -56,6 +56,8 @@
 import org.codehaus.plexus.action.ActionNotFoundException;
 import org.codehaus.plexus.context.Context;
 import org.codehaus.plexus.context.ContextException;
+import org.codehaus.plexus.formica.FormicaException;
+import org.codehaus.plexus.formica.validation.Validator;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
@@ -150,6 +152,11 @@
      */
     private BuildExecutorManager executorManager;
 
+    /**
+     * @plexus.requirement role-hint="url"
+     */
+    private Validator urlValidator;
+
     private boolean stopped = false;
 
     public DefaultContinuum()
@@ -1115,6 +1122,20 @@
                                                                                    int projectGroupId
)
         throws ContinuumException
     {
+        try
+        {
+            if ( !urlValidator.validate( metadataUrl ) )
+            {
+                ContinuumProjectBuildingResult res = new ContinuumProjectBuildingResult();
+                res.addError( ContinuumProjectBuildingResult.ERROR_PROTOCOL_NOT_ALLOWED );
+                return res;
+            }
+        }
+        catch( FormicaException e )
+        {
+            //can't be thrown
+        }
+
         Map context = new HashMap();
 
         context.put( CreateProjectsFromMetadataAction.KEY_PROJECT_BUILDER_ID, projectBuilderId
);

Modified: maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml?view=diff&rev=484614&r1=484613&r2=484614
==============================================================================
--- maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
(original)
+++ maven/continuum/trunk/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
Fri Dec  8 06:14:01 2006
@@ -180,5 +180,24 @@
         </requirement>
       </requirements>
     </component>
+
+    <!--
+     |
+     | Validators
+     |
+    -->
+    <component>
+      <role>org.codehaus.plexus.formica.validation.Validator</role>
+      <role-hint>url</role-hint>
+      <implementation>org.codehaus.plexus.formica.validation.UrlValidator</implementation>
+      <configuration>
+        <allowedSchemes>
+          <allowedScheme>http</allowedScheme>
+          <allowedScheme>https</allowedScheme>
+          <allowedScheme>ftp</allowedScheme>
+          <allowedScheme>file</allowedScheme>
+        </allowedSchemes>
+      </configuration>
+    </component>
   </components>
 </plexus>

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?view=diff&rev=484614&r1=484613&r2=484614
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Fri Dec  8 06:14:01 2006
@@ -168,6 +168,7 @@
 add.project.missing.notifier.type.error = Missing 'type' sub-element in the 'notifier' element
in the POM.
 add.project.missing.notifier.configuration.error = Missing 'configuration' sub-element in
the 'notifier' element in the POM.
 add.project.metadata.transfer.error = Transfer of Metadata has failed.
+add.project.validation.protocol.not_allowed = The specified resource isn't a file or the
protocol used isn't allowed.
 add.project.unauthorized.error = You are not authorized to access the requested URL. Please
verify that the correct username and password are provided.
 add.project.artifact.not.found.error = Missing artifact trying to build the POM. Check that
its parent POM is available or add it first in Continuum.
 add.project.project.building.error = Unknown error trying to build POM.



Mime
View raw message