From 1efcee22948fc851b10093f4216ed7ca23f7ceed Mon Sep 17 00:00:00 2001 From: ltheussl Date: Thu, 19 Jan 2006 21:19:45 +0000 Subject: [PATCH] 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 --- .../org/apache/maven/xdoc/util/ScmUtil.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java b/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java index 799a149d..edcd4185 100644 --- a/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java +++ b/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java @@ -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; }