You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2018/05/10 23:35:16 UTC

[maven-scm] 01/01: Lets see

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch SCM-887
in repository https://gitbox.apache.org/repos/asf/maven-scm.git

commit e9532d491c87b1311f939a53d3003f821afd8b1e
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri May 11 01:34:58 2018 +0200

    Lets see
---
 .../svn/svnexe/command/SvnCommandLineUtils.java    | 47 ++++++++++++++--------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java
index a4c9c4a..d7fb959 100644
--- a/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java
+++ b/maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/SvnCommandLineUtils.java
@@ -222,30 +222,42 @@ public final class SvnCommandLineUtils
     {
         String clString = cl.toString();
 
-        final String passwordArg = "--password ";
+        final String passwordOpt = "--password";
         String quoteChar;
         String escapedQuoteChar;
         String cryptedPassword;
 
-        int pos = clString.indexOf( passwordArg );
+        int pos = clString.indexOf( passwordOpt );
 
         if ( pos > 0 )
         {
-            String beforePassword = clString.substring( 0, pos + passwordArg.length() );
-            String afterPassword = clString.substring( pos + passwordArg.length() );
-
-            if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
-            {
-                 quoteChar = "\"";
-                 escapedQuoteChar = "\"\"";
-                 cryptedPassword = "*****";
-            }
-            else
-            {
-                quoteChar = "'";
-                escapedQuoteChar = "'\\''";
-                cryptedPassword = "'*****'";
-            }
+           if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
+           {
+                quoteChar = "\"";
+                escapedQuoteChar = "\"\"";
+                cryptedPassword = "*****";
+           }
+           else
+           {
+               quoteChar = "'";
+               escapedQuoteChar = "'\"'\"'";
+               cryptedPassword = "'*****'";
+           }
+
+           // Move pointer after password option
+           pos += passwordOpt.length();
+
+           // Skip quote after password option
+           if ( clString.substring( pos,  pos + 1 ).equals( quoteChar ) )
+           {
+               pos++;
+           }
+
+           // Skip space after password option
+           pos++;
+
+            String beforePassword = clString.substring( 0, pos );
+            String afterPassword = clString.substring( pos );
 
             if ( afterPassword.startsWith( quoteChar ) )
             {
@@ -259,6 +271,7 @@ public final class SvnCommandLineUtils
             }
             else
             {
+                // We assume that the password arg ist not the last one on the arg list
                 afterPassword = afterPassword.substring( afterPassword.indexOf( ' ' ) );
             }
 

-- 
To stop receiving notification emails like this one, please contact
michaelo@apache.org.