You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Brett Porter <br...@apache.org> on 2008/05/24 04:00:24 UTC

Re: svn commit: r659677 - in /maven/components/branches/maven-2.0.x: maven-model/src/main/mdo/maven.mdo maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java

Could this break on any POMs in the repository?

On 24/05/2008, at 7:50 AM, jdcasey@apache.org wrote:

> Author: jdcasey
> Date: Fri May 23 14:50:50 2008
> New Revision: 659677
>
> URL: http://svn.apache.org/viewvc?rev=659677&view=rev
> Log:
> [MNG-2739] Adding validation to ProjectUtils for construction of  
> ArtifactRepository instances (this is used ahead of the model  
> validator invocation).
>
> Modified:
>    maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/ 
> maven.mdo
>    maven/components/branches/maven-2.0.x/maven-project/src/main/java/ 
> org/apache/maven/project/ProjectUtils.java
>
> Modified: maven/components/branches/maven-2.0.x/maven-model/src/main/ 
> mdo/maven.mdo
> URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo?rev=659677&r1=659676&r2=659677&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/ 
> maven.mdo (original)
> +++ maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/ 
> maven.mdo Fri May 23 14:50:50 2008
> @@ -2636,6 +2636,7 @@
>         <field>
>           <name>id</name>
>           <version>4.0.0</version>
> +          <required>true</required>
>           <description>
>             <![CDATA[
>             A unique identifier for a repository. This is used to  
> match the repository
> @@ -2657,6 +2658,7 @@
>         <field>
>           <name>url</name>
>           <version>4.0.0</version>
> +          <required>true</required>
>           <description>
>             <![CDATA[
>             The url of the repository, in the form <code>protocol:// 
> hostname/path</code>.
>
> Modified: maven/components/branches/maven-2.0.x/maven-project/src/ 
> main/java/org/apache/maven/project/ProjectUtils.java
> URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java?rev=659677&r1=659676&r2=659677&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- maven/components/branches/maven-2.0.x/maven-project/src/main/ 
> java/org/apache/maven/project/ProjectUtils.java (original)
> +++ maven/components/branches/maven-2.0.x/maven-project/src/main/ 
> java/org/apache/maven/project/ProjectUtils.java Fri May 23 14:50:50  
> 2008
> @@ -96,6 +96,16 @@
>             String id = repo.getId();
>             String url = repo.getUrl();
>
> +            if ( id == null || id.trim().length() < 1 )
> +            {
> +                throw new InvalidRepositoryException( "Repository  
> ID must not be empty (URL is: " + url + ").", new  
> IllegalArgumentException( "repository.id" ) );
> +            }
> +
> +            if ( url == null || url.trim().length() < 1 )
> +            {
> +                throw new InvalidRepositoryException( "Repository  
> URL must not be empty (ID is: " + id + ").", new  
> IllegalArgumentException( "repository.url" ) );
> +            }
> +
>             // TODO: make this a map inside the factory instead, so  
> no lookup needed
>             ArtifactRepositoryLayout layout =  
> getRepositoryLayout( repo, container );
>
>
>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r659677 - in /maven/components/branches/maven-2.0.x: maven-model/src/main/mdo/maven.mdo maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java

Posted by John Casey <jd...@commonjava.org>.
Hmm, as far as the validator change, I'm not entirely sure whether it 
would change,  but I'm guessing there would be a NPE following shortly 
if it didn't fail here (since repositories are definitely used from 
remote POMs).

-john

Brett Porter wrote:
> Could this break on any POMs in the repository?
>
> On 24/05/2008, at 7:50 AM, jdcasey@apache.org wrote:
>
>> Author: jdcasey
>> Date: Fri May 23 14:50:50 2008
>> New Revision: 659677
>>
>> URL: http://svn.apache.org/viewvc?rev=659677&view=rev
>> Log:
>> [MNG-2739] Adding validation to ProjectUtils for construction of 
>> ArtifactRepository instances (this is used ahead of the model 
>> validator invocation).
>>
>> Modified:
>>    
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo
>>    
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>>
>>
>> Modified: 
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo
>> URL: 
>> http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo?rev=659677&r1=659676&r2=659677&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo 
>> (original)
>> +++ 
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo 
>> Fri May 23 14:50:50 2008
>> @@ -2636,6 +2636,7 @@
>>         <field>
>>           <name>id</name>
>>           <version>4.0.0</version>
>> +          <required>true</required>
>>           <description>
>>             <![CDATA[
>>             A unique identifier for a repository. This is used to 
>> match the repository
>> @@ -2657,6 +2658,7 @@
>>         <field>
>>           <name>url</name>
>>           <version>4.0.0</version>
>> +          <required>true</required>
>>           <description>
>>             <![CDATA[
>>             The url of the repository, in the form 
>> <code>protocol://hostname/path</code>.
>>
>> Modified: 
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java?rev=659677&r1=659676&r2=659677&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>> (original)
>> +++ 
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>> Fri May 23 14:50:50 2008
>> @@ -96,6 +96,16 @@
>>             String id = repo.getId();
>>             String url = repo.getUrl();
>>
>> +            if ( id == null || id.trim().length() < 1 )
>> +            {
>> +                throw new InvalidRepositoryException( "Repository ID 
>> must not be empty (URL is: " + url + ").", new 
>> IllegalArgumentException( "repository.id" ) );
>> +            }
>> +
>> +            if ( url == null || url.trim().length() < 1 )
>> +            {
>> +                throw new InvalidRepositoryException( "Repository 
>> URL must not be empty (ID is: " + id + ").", new 
>> IllegalArgumentException( "repository.url" ) );
>> +            }
>> +
>>             // TODO: make this a map inside the factory instead, so 
>> no lookup needed
>>             ArtifactRepositoryLayout layout = getRepositoryLayout( 
>> repo, container );
>>
>>
>>
>
> -- 
> Brett Porter
> brett@apache.org
> http://blogs.exist.com/bporter/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

-- 
John Casey
Developer, PMC Member - Apache Maven (http://maven.apache.org)
Blog: http://www.ejlife.net/blogs/buildchimp/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: svn commit: r659677 - in /maven/components/branches/maven-2.0.x: maven-model/src/main/mdo/maven.mdo maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java

Posted by John Casey <jd...@commonjava.org>.
In fact, I don't think it has any effect whatsoever. I made this change, 
rebuilt maven and tried it vs. two POMs - one missing a repository id, 
the other missing a repository url - and neither one failed during model 
parsing. I only left these changes intact in case we move to a later 
version of modello later that actually works for this stuff.

-john

Brett Porter wrote:
> Could this break on any POMs in the repository?
>
> On 24/05/2008, at 7:50 AM, jdcasey@apache.org wrote:
>
>> Author: jdcasey
>> Date: Fri May 23 14:50:50 2008
>> New Revision: 659677
>>
>> URL: http://svn.apache.org/viewvc?rev=659677&view=rev
>> Log:
>> [MNG-2739] Adding validation to ProjectUtils for construction of 
>> ArtifactRepository instances (this is used ahead of the model 
>> validator invocation).
>>
>> Modified:
>>    
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo
>>    
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>>
>>
>> Modified: 
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo
>> URL: 
>> http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo?rev=659677&r1=659676&r2=659677&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo 
>> (original)
>> +++ 
>> maven/components/branches/maven-2.0.x/maven-model/src/main/mdo/maven.mdo 
>> Fri May 23 14:50:50 2008
>> @@ -2636,6 +2636,7 @@
>>         <field>
>>           <name>id</name>
>>           <version>4.0.0</version>
>> +          <required>true</required>
>>           <description>
>>             <![CDATA[
>>             A unique identifier for a repository. This is used to 
>> match the repository
>> @@ -2657,6 +2658,7 @@
>>         <field>
>>           <name>url</name>
>>           <version>4.0.0</version>
>> +          <required>true</required>
>>           <description>
>>             <![CDATA[
>>             The url of the repository, in the form 
>> <code>protocol://hostname/path</code>.
>>
>> Modified: 
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java?rev=659677&r1=659676&r2=659677&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>> (original)
>> +++ 
>> maven/components/branches/maven-2.0.x/maven-project/src/main/java/org/apache/maven/project/ProjectUtils.java 
>> Fri May 23 14:50:50 2008
>> @@ -96,6 +96,16 @@
>>             String id = repo.getId();
>>             String url = repo.getUrl();
>>
>> +            if ( id == null || id.trim().length() < 1 )
>> +            {
>> +                throw new InvalidRepositoryException( "Repository ID 
>> must not be empty (URL is: " + url + ").", new 
>> IllegalArgumentException( "repository.id" ) );
>> +            }
>> +
>> +            if ( url == null || url.trim().length() < 1 )
>> +            {
>> +                throw new InvalidRepositoryException( "Repository 
>> URL must not be empty (ID is: " + id + ").", new 
>> IllegalArgumentException( "repository.url" ) );
>> +            }
>> +
>>             // TODO: make this a map inside the factory instead, so 
>> no lookup needed
>>             ArtifactRepositoryLayout layout = getRepositoryLayout( 
>> repo, container );
>>
>>
>>
>
> -- 
> Brett Porter
> brett@apache.org
> http://blogs.exist.com/bporter/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>

-- 
John Casey
Developer, PMC Member - Apache Maven (http://maven.apache.org)
Blog: http://www.ejlife.net/blogs/buildchimp/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org