You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/10/27 14:31:05 UTC

cvs commit: maven/src/java/org/apache/maven/verifier DependencyVerifier.java

jvanzyl     2003/10/27 05:31:05

  Modified:    src/java/org/apache/maven/verifier DependencyVerifier.java
  Log:
  o fix for problem reported by Edmund Urbani where https urls don't get processed properly.
  
  Revision  Changes    Path
  1.33      +10 -2     maven/src/java/org/apache/maven/verifier/DependencyVerifier.java
  
  Index: DependencyVerifier.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/verifier/DependencyVerifier.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- DependencyVerifier.java	4 Sep 2003 15:19:25 -0000	1.32
  +++ DependencyVerifier.java	27 Oct 2003 13:31:05 -0000	1.33
  @@ -337,7 +337,15 @@
               // used here. Those are the "" parameters you see below.
               String url = remoteRepo + "/" + artifact.getUrlPath();
               url = StringUtils.replace( url, "//", "/" );
  -            url = StringUtils.replace( url, "http:/", "http://" );
  +
  +            if ( url.indexOf( "https" ) > 0 )
  +            {
  +                url = StringUtils.replace( url, "https:/", "https://" );
  +            }
  +            else
  +            {
  +                url = StringUtils.replace( url, "http:/", "http://" );
  +            }
   
               // Attempt to retrieve the artifact and set the checksum if retrieval
               // of the checksum file was successful.
  
  
  

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


Re: cvs commit: maven/src/java/org/apache/maven/verifier DependencyVerifier.java

Posted by Martin Skopp <sk...@riege.com>.
Nice fix Jason,

but after all, this piece of code looks a bit strange...

I know maven only supports HTTP and HTTPS, but I remind that I once used
FILE:// (or was it FILE:/// ?) and it worked also (somehow..)

Shouldn't it better (possibly in the future more protocols are supported
- you never know)  be something like:

-- VERSION 1 --
String url = remoteRepo + (remoteRepo.endsWith("/" ? "" : "/")  +
artifact.getUrlPath();
// and no more modification of url
-- VERSION 1 end --

or maybe 

-- VERSION 2 --
String url = remoteRepo + "/" + artifact.getUrlPath();
if (url.startsWith( "https://" ) {
	url = StringUtils.replace( url, "//", "/" );
	url = StringUtils.replace( url, "https:/", "https://" );
} else if (url.startsWith( "http://" ) {
	url = StringUtils.replace( url, "//", "/" );
	url = StringUtils.replace( url, "http:/", "http://" );
} else {
	// leave the url better unchanged....
}
-- VERSION 2 end --

On Mon, 2003-10-27 at 14:31, jvanzyl@apache.org wrote:
> jvanzyl     2003/10/27 05:31:05
> 
>   Modified:    src/java/org/apache/maven/verifier DependencyVerifier.java
>   Log:
>   o fix for problem reported by Edmund Urbani where https urls don't get processed properly.
>   
>   Revision  Changes    Path
>   1.33      +10 -2     maven/src/java/org/apache/maven/verifier/DependencyVerifier.java
>   
>   Index: DependencyVerifier.java
>   ===================================================================
>   RCS file: /home/cvs/maven/src/java/org/apache/maven/verifier/DependencyVerifier.java,v
>   retrieving revision 1.32
>   retrieving revision 1.33
>   diff -u -r1.32 -r1.33
>   --- DependencyVerifier.java	4 Sep 2003 15:19:25 -0000	1.32
>   +++ DependencyVerifier.java	27 Oct 2003 13:31:05 -0000	1.33
>   @@ -337,7 +337,15 @@
>                // used here. Those are the "" parameters you see below.
>                String url = remoteRepo + "/" + artifact.getUrlPath();
>                url = StringUtils.replace( url, "//", "/" );
>   -            url = StringUtils.replace( url, "http:/", "http://" );
>   +
>   +            if ( url.indexOf( "https" ) > 0 )
>   +            {
>   +                url = StringUtils.replace( url, "https:/", "https://" );
>   +            }
>   +            else
>   +            {
>   +                url = StringUtils.replace( url, "http:/", "http://" );
>   +            }
>    
>                // Attempt to retrieve the artifact and set the checksum if retrieval
>                // of the checksum file was successful.
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
-- 
Martin Skopp
Riege Software International GmbH
Support: mailto:maint@riege.com, Information: http://www.riege.com
 
This email is intended to be viewed with a nonproportional font.
Public Key on http://www.keyserver.net, Key-ID: 3D4027B5
Fingerprint: 1970 C78D 9A1D 99FA 5CE4  5C0D 29E6 6A95 3D40 27B5



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