You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2006/01/19 22:19:49 UTC

svn commit: r370636 - /maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java

Author: ltheussl
Date: Thu Jan 19 13:19:45 2006
New Revision: 370636

URL: http://svn.apache.org/viewcvs?rev=370636&view=rev
Log:
Replace hard-coded separator strings. Thanks to Dennis Lundberg.

Modified:
    maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java

Modified: maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java?rev=370636&r1=370635&r2=370636&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java Thu Jan 19 13:19:45 2006
@@ -1,7 +1,7 @@
 package org.apache.maven.xdoc.util;
 
 /* ====================================================================
- *   Copyright 2001-2004 The Apache Software Foundation.
+ *   Copyright 2001-2006 The Apache Software Foundation.
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -119,9 +119,10 @@
     }
 
     /**
-     * Get cvs connection string. Used in xdocs/src/plugin-resources/templates/cvs-usage.xml.
+     * Get cvs connection string.
+     * Used in xdocs/src/plugin-resources/templates/cvs-usage.xml.
      * If username == "", assumes anonymous (pserver) connection. In this case,
-     * inserts a ':' between the username and '@' to indicate
+     * inserts a separator (':' or '|') between the username and '@' to indicate
      * that there is a password and that it is empty.
      * If username != "" it replaces username in conn.
      * 
@@ -138,16 +139,25 @@
             return "";
         }
 
+        // The length of conn has already been checked in the call to
+        // splitSCMConnection(conn) above, so it's OK to just extract the char.
+        String separator = "" + conn.charAt(3);
+
         if (tokens[3].indexOf('@') >= 0)
         {
             if (username.length() == 0)
             {
-                username = tokens[3].substring(0, tokens[3].indexOf('@')) + ":";
+                username = tokens[3].substring(0, tokens[3].indexOf('@'))
+                    + separator;
             }
-            tokens[3] = username + "@" + tokens[3].substring(tokens[3].indexOf('@') + 1);
+            tokens[3] = username + "@"
+                + tokens[3].substring(tokens[3].indexOf('@') + 1);
         }
-        String result = tokens[0] + ":" + tokens[1] + ":" + tokens[2] + ":" + tokens[3]
-            + ":" + tokens[4] + ":" + tokens[5];
+
+        String result = tokens[0] + separator + tokens[1] + separator
+            + tokens[2] + separator + tokens[3] + separator + tokens[4]
+            + separator + tokens[5];
+
         return result;
     }