maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <br...@apache.org>
Subject Re: svn commit: r592157 - in /maven/components/trunk/maven-project/src: main/java/org/apache/maven/project/ test/java/org/apache/maven/project/
Date Tue, 06 Nov 2007 01:56:02 GMT
It's coming back to me now :) We see this a lot in surefire - for  
that reason there's a util class in there to support converting the  
classloader URLs on JDKs back to 1.3.

- Brett

On 06/11/2007, at 12:40 PM, John Casey wrote:

> Well, I guess that means the ClassLoader.getResource(..) method  
> doesn't
> always return RFC 2396-compliant URLs, then...because there's  
> definitely a
> space in the returned URL, and the URI construction definitely  
> fails prior
> to this change. MNG-3272 details the error I was working with when  
> I made
> this correction.
>
> -john
>
> On 11/5/07, Carlos Sanchez <carlos@apache.org> wrote:
>>
>> For more info
>>
>> I was using the URL.toURI method but it's only available in java 5
>> http://java.sun.com/javase/6/docs/api/java/net/URL.html#toURI()
>>
>> "This method functions in the same way as new URI (this.toString()).
>> Note, any URL instance that complies with RFC 2396 can be  
>> converted to
>> a URI. However, some URLs that are not strictly in compliance can not
>> be converted to a URI."
>>
>> On Nov 5, 2007 5:26 PM, Brett Porter <brett@apache.org> wrote:
>>> cool, thanks
>>>
>>>
>>> On 06/11/2007, at 11:52 AM, John Casey wrote:
>>>
>>>> I tried several different ideas (actually, I used the unit test to
>>>> try out various strategies), and this is the best thing I could
>>>> come up with at the time. Since spaces in file paths is about the
>>>> only weird character I've heard about in connection with these
>>>> sorts of problems, I figured it was an acceptable interim solution
>>>> until someone else found a better way.
>>>>
>>>> Personally, I'm not convinced of the value of having a URI that
>>>> references the super-POM anyway...or, for that matter, why we need
>>>> URI's at all in this stuff. This commit was to correct changes
>>>> Carlos put in place, so maybe he can speak to that. I was just
>>>> trying to get the maven build back on its feet for those of us
>>>> using Program Files to house their Maven instances.
>>>>
>>>> -john
>>>>
>>>> On Nov 5, 2007, at 7:31 PM, Brett Porter wrote:
>>>>
>>>>> Will this fall over on any other characters? ISTR there being a
>>>>> standard way to get a proper file URL reference for these
>>>>> occurrences, but it's slipping my mind right now...
>>>>>
>>>>> On 06/11/2007, at 8:40 AM, jdcasey@apache.org wrote:
>>>>>
>>>>>> Author: jdcasey
>>>>>> Date: Mon Nov  5 13:40:11 2007
>>>>>> New Revision: 592157
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=592157&view=rev
>>>>>> Log:
>>>>>> [MNG-3272] Fixing URI construction for reading the super-POM in
>>>>>> cases where maven is in a directory structure where there are
>>>>>> spaces in the path.
>>>>>>
>>>>>> Added:
>>>>>>     maven/components/trunk/maven-project/src/test/java/org/ 
>>>>>> apache/
>>>>>> maven/project/ProjectBuilderURITest.java   (with props)
>>>>>> Modified:
>>>>>>     maven/components/trunk/maven-project/src/main/java/org/ 
>>>>>> apache/
>>>>>> maven/project/DefaultMavenProjectBuilder.java
>>>>>>     maven/components/trunk/maven-project/src/test/java/org/ 
>>>>>> apache/
>>>>>> maven/project/AbstractMavenProjectTestCase.java
>>>>>>
>>>>>> Modified: maven/components/trunk/maven-project/src/main/java/org/
>>>>>> apache/maven/project/DefaultMavenProjectBuilder.java
>>>>>> URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-
>>>>>> project/src/main/java/org/apache/maven/project/
>>>>>> DefaultMavenProjectBuilder.java?
>>>>>> rev=592157&r1=592156&r2=592157&view=diff
>>>>>> =================================================================

>>>>>> ===
>>>>>> ==========
>>>>>> --- maven/components/trunk/maven-project/src/main/java/org/ 
>>>>>> apache/
>>>>>> maven/project/DefaultMavenProjectBuilder.java (original)
>>>>>> +++ maven/components/trunk/maven-project/src/main/java/org/ 
>>>>>> apache/
>>>>>> maven/project/DefaultMavenProjectBuilder.java Mon Nov  5 13:40:11
>>>>>> 2007
>>>>>> @@ -1059,7 +1059,7 @@
>>>>>>          URI uri = null;
>>>>>>          try
>>>>>>          {
>>>>>> -            uri = new URI( url.toString() );
>>>>>> +            uri = new URI( url.toString().replaceAll( " ", "%
>>>>>> 20" ) );
>>>>>>              reader = ReaderFactory.newXmlReader( url.openStream
>>>>>> () );
>>>>>>              return readModel( projectId, uri, reader, strict );
>>>>>>          }
>>>>>>
>>>>>> Modified: maven/components/trunk/maven-project/src/test/java/org/
>>>>>> apache/maven/project/AbstractMavenProjectTestCase.java
>>>>>> URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-
>>>>>> project/src/test/java/org/apache/maven/project/
>>>>>> AbstractMavenProjectTestCase.java?
>>>>>> rev=592157&r1=592156&r2=592157&view=diff
>>>>>> =================================================================

>>>>>> ===
>>>>>> ==========
>>>>>> --- maven/components/trunk/maven-project/src/test/java/org/ 
>>>>>> apache/
>>>>>> maven/project/AbstractMavenProjectTestCase.java (original)
>>>>>> +++ maven/components/trunk/maven-project/src/test/java/org/ 
>>>>>> apache/
>>>>>> maven/project/AbstractMavenProjectTestCase.java Mon Nov  5
>>>>>> 13:40:11 2007
>>>>>> @@ -80,7 +80,7 @@
>>>>>>              throw new FileNotFoundException( "Unable to find: "
>>>>>> + resource );
>>>>>>          }
>>>>>>
>>>>>> -        return new File( new URI( resourceUrl.toString() ) );
>>>>>> +        return new File( new URI( resourceUrl.toString
>>>>>> ().replaceAll( " ", "%20" ) ) );
>>>>>>      }
>>>>>>
>>>>>>      protected ArtifactRepository getLocalRepository()
>>>>>>
>>>>>> Added: maven/components/trunk/maven-project/src/test/java/org/
>>>>>> apache/maven/project/ProjectBuilderURITest.java
>>>>>> URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-
>>>>>> project/src/test/java/org/apache/maven/project/
>>>>>> ProjectBuilderURITest.java?rev=592157&view=auto
>>>>>> =================================================================

>>>>>> ===
>>>>>> ==========
>>>>>> --- maven/components/trunk/maven-project/src/test/java/org/ 
>>>>>> apache/
>>>>>> maven/project/ProjectBuilderURITest.java (added)
>>>>>> +++ maven/components/trunk/maven-project/src/test/java/org/ 
>>>>>> apache/
>>>>>> maven/project/ProjectBuilderURITest.java Mon Nov  5 13:40:11 2007
>>>>>> @@ -0,0 +1,32 @@
>>>>>> +package org.apache.maven.project;
>>>>>> +
>>>>>> +import java.io.UnsupportedEncodingException;
>>>>>> +import java.net.MalformedURLException;
>>>>>> +import java.net.URI;
>>>>>> +import java.net.URISyntaxException;
>>>>>> +import java.net.URL;
>>>>>> +
>>>>>> +import junit.framework.TestCase;
>>>>>> +
>>>>>> +public class ProjectBuilderURITest
>>>>>> +    extends TestCase
>>>>>> +{
>>>>>> +
>>>>>> +    /**
>>>>>> +     * MNG-3272:
>>>>>> +     * See {@link DefaultMavenProjectBuilder#readModel(String,
>>>>>> URL, boolean)}
>>>>>> +     * for where this fix is implemented.
>>>>>> +     */
>>>>>> +    public void
>>>>>> testURL_to_URI_forSuperPom_WhenMavenHasSpaceInPath()
>>>>>> +        throws URISyntaxException, MalformedURLException,
>>>>>> UnsupportedEncodingException
>>>>>> +    {
>>>>>> +        String url = "jar:file:/c:/Program Files/maven2.1/ 
>>>>>> bin/../
>>>>>> lib/maven-project-2.1-SNAPSHOT.jar!/org/apache/maven/project/
>>>>>> pom-4.0.0.xml";
>>>>>> +        System.out.println( "Original URL String:\n" + url );
>>>>>> +
>>>>>> +        URL urlInst = new URL( url );
>>>>>> +
>>>>>> +        URI uUri = new URI( urlInst.toExternalForm().replaceAll
>>>>>> ( " ", "%20" ) );
>>>>>> +        System.out.println( "URI result:\n" + uUri );
>>>>>> +    }
>>>>>> +
>>>>>> +}
>>>>>>
>>>>>> Propchange: maven/components/trunk/maven-project/src/test/java/
>>>>>> org/apache/maven/project/ProjectBuilderURITest.java
>>>>>> -----------------------------------------------------------------

>>>>>> ---
>>>>>> ----------
>>>>>>     svn:eol-style = native
>>>>>>
>>>>>> Propchange: maven/components/trunk/maven-project/src/test/java/
>>>>>> org/apache/maven/project/ProjectBuilderURITest.java
>>>>>> -----------------------------------------------------------------

>>>>>> ---
>>>>>> ----------
>>>>>>     svn:keywords = "Author Date Id Revision"
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Brett Porter - brett@apache.org
>>>>> Blog: http://www.devzuz.org/blogs/bporter/
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------ 
>>>>> ---
>>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>>
>>>>
>>>> ---
>>>> John Casey
>>>> Committer and PMC Member, Apache Maven
>>>> mail: jdcasey at commonjava dot org
>>>> blog: http://www.ejlife.net/blogs/john
>>>> rss: http://feeds.feedburner.com/ejlife/john
>>>>
>>>>
>>>
>>> --
>>> Brett Porter - brett@apache.org
>>> Blog: http://www.devzuz.org/blogs/bporter/
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>
>>
>>
>> --
>> I could give you my word as a Spaniard.
>> No good. I've known too many Spaniards.
>>                              -- The Princess Bride
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
>
> -- 
> John Casey
> ---
> Maven Developer (http://maven.apache.org)
> ---
> Blog: http://www.ejlife.net/blogs/buildchimp

--
Brett Porter - brett@apache.org
Blog: http://www.devzuz.org/blogs/bporter/


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


Mime
View raw message