You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by br...@apache.org on 2008/05/21 06:48:06 UTC

svn commit: r658551 - /maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java

Author: brett
Date: Tue May 20 21:48:05 2008
New Revision: 658551

URL: http://svn.apache.org/viewvc?rev=658551&view=rev
Log:
[WAGON-210] handle protocol names case-insensitively
Submitted by: Benjamin Bentmann

Modified:
    maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java

Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java?rev=658551&r1=658550&r2=658551&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java (original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/PathUtils.java Tue May 20 21:48:05 2008
@@ -150,13 +150,13 @@
 
         final String protocol = PathUtils.protocol( url );
 
-        if ( protocol == null || protocol.equals( "file" ) )
+        if ( protocol == null || protocol.equalsIgnoreCase( "file" ) )
         {
             return "localhost";
         }
 
         String host = url;
-        if ( protocol.equals( "scm" ) )
+        if ( protocol.equalsIgnoreCase( "scm" ) )
         {
             // skip over type
             host = host.substring( host.indexOf( ":", 4 ) + 1 ).trim();
@@ -224,7 +224,7 @@
 
         final String protocol = PathUtils.protocol( url );
 
-        if ( protocol == null || protocol.equals( "file" ) )
+        if ( protocol == null || protocol.equalsIgnoreCase( "file" ) )
         {
             return WagonConstants.UNKNOWN_PORT;
         }
@@ -236,13 +236,13 @@
             return WagonConstants.UNKNOWN_PORT;
         }
 
-        if ( protocol.equals( "scm" ) )
+        if ( protocol.equalsIgnoreCase( "scm" ) )
         {
             // skip over type
             url = url.substring( url.indexOf( ":", 4 ) + 1 ).trim();
         }
 
-        if ( url.startsWith( "file:" ) || url.startsWith( "local:" ) )
+        if ( url.regionMatches( true, 0, "file:", 0, 5 ) || url.regionMatches( true, 0, "local:", 0, 6 ) )
         {
             return WagonConstants.UNKNOWN_PORT;
         }
@@ -293,17 +293,17 @@
 
         String retValue = null;
 
-        if ( protocol.equals( "scm" ) )
+        if ( protocol.equalsIgnoreCase( "scm" ) )
         {
             // skip over SCM bits
-            if ( url.startsWith( "scm:svn:" ) )
+            if ( url.regionMatches( true, 0, "scm:svn:", 0, 8 ) )
             {
                 url = url.substring( url.indexOf( ":", 4 ) + 1 );
                 protocol = PathUtils.protocol( url );
             }
         }
 
-        if ( protocol.equals( "file" ) )
+        if ( protocol.equalsIgnoreCase( "file" ) )
         {
             retValue = url.substring( protocol.length() + 1 );
             // special case: if omitted // on protocol, keep path as is
@@ -352,7 +352,7 @@
 
             int pos;
 
-            if ( protocol.equals( "scm" ) )
+            if ( protocol.equalsIgnoreCase( "scm" ) )
             {
                 pos = url.indexOf( ":", 4 ) + 1;
                 pos = url.indexOf( ":", pos ) + 1;



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