Replace hard-coded separator strings. Thanks to Dennis Lundberg.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@370636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2006-01-19 21:19:45 +00:00
parent e424286e61
commit 1efcee2294

View File

@ -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 @@ public final class ScmUtil
}
/**
* 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 @@ public final class ScmUtil
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;
}