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 791826f4..837159dc 100644 --- a/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java +++ b/xdoc/src/main/org/apache/maven/xdoc/util/ScmUtil.java @@ -49,84 +49,9 @@ public final class ScmUtil return null; } - /** - * Get cvs root. - * - * @param scmConnection the scm connection to analyse. - * @return CVS root. - */ - public String getCvsRoot( String scmConnection ) - { - if ( isValid( scmConnection ) ) - { - return getCvsRoot( scmConnection, "" ); - } - - return null; - } - - /** - * Get cvs server. Used in - * xdocs/src/plugin-resources/templates/cvs-usage.xml. - * - * @param conn six token connection string - * @return CVS module. - */ - public String getCvsServer( String conn ) - { - String[] tokens = splitSCMConnection( conn ); - - if ( !tokens[1].equals( "cvs" ) ) - { - return ""; - } - - if ( tokens[3].indexOf( '@' ) >= 0 ) - { - return tokens[3].substring( tokens[3].indexOf( '@' ) + 1 ); - } - else - { - return tokens[3]; - } - } - - /** - * Get cvs root. Used in xdocs/src/plugin-resources/templates/cvs-usage.xml. - * - * @param conn six token connection string - * @param username username override if non-empty. - * @return CVS root. - */ - public String getCvsRoot( String conn, String username ) - { - String[] tokens = splitSCMConnection( conn ); - - if ( !tokens[1].equals( "cvs" ) ) - { - return ""; - } - - if ( tokens[3].indexOf( '@' ) >= 0 ) - { - if ( username.length() == 0 ) - { - username = tokens[3].substring( 0, tokens[3].indexOf( '@' ) ); - } - - tokens[3] = - username + "@" - + tokens[3].substring( tokens[3].indexOf( '@' ) + 1 ); - } - - String result = ":" + tokens[2] + ":" + tokens[3] + ":" + tokens[4]; - - return result; - } - /** * Get cvs connection string. - * Used in xdocs/src/plugin-resources/templates/cvs-usage.xml. + * Used in xdocs/src/plugin-resources/templates/scm/cvs.xml. * If username == "", assumes anonymous (pserver) connection. In this case, * inserts a separator (':' or '|') between the username and '@' to indicate * that there is a password and that it is empty. @@ -145,9 +70,7 @@ 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 ); + String separator = getSCMConnectionSeparator( conn ); if ( tokens[3].indexOf( '@' ) >= 0 ) { @@ -164,7 +87,7 @@ public final class ScmUtil } String result = - tokens[0] + separator + tokens[1] + separator + tokens[2] + tokens[0] + ":" + tokens[1] + separator + tokens[2] + separator + tokens[3] + separator + tokens[4] + separator + tokens[5]; @@ -173,7 +96,7 @@ public final class ScmUtil /** * Get cvs module. Used in - * xdocs/src/plugin-resources/templates/cvs-usage.xml. + * xdocs/src/plugin-resources/templates/scm/cvs.xml. * * @param conn six token connection string * @return CVS module.