[ https://issues.apache.org/jira/browse/SCM-387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17964556#comment-17964556 ]
Olivier Lamy commented on SCM-387: ---------------------------------- This project has moved from Jira to GitHub Issues. This issue was migrated to [apache/maven-scm#602|https://github.com/apache/maven-scm/issues/602]. > CvsScmProviderRepository returns wrong CVSROOT for local repository > ------------------------------------------------------------------- > > Key: SCM-387 > URL: https://issues.apache.org/jira/browse/SCM-387 > Project: Maven SCM (Moved to GitHub Issues) > Issue Type: Bug > Components: maven-scm-provider-cvs > Affects Versions: 1.1 > Reporter: Sergey Zakusov > Assignee: Siveton Vincent > Priority: Blocker > Fix For: 1.1 > > > For local repository getCvsRoot() returns just the root path without > transport type - see getCvsRootForCvsPass: > {code:title=CvsScmProviderRepository.java|borderStyle=solid} > /** > * @return The cvs root > */ > public String getCvsRoot() > { > String root = getCvsRootForCvsPass(); > return removeDefaultPortFromCvsRoot( root ); > } > private String removeDefaultPortFromCvsRoot( String root ) > { > if ( root != null && root.indexOf( ":2401" ) > 0 ) > { > root = root.substring( 0, root.indexOf( ":2401" ) ) + ":" + > root.substring( root.indexOf( ":2401" ) + 5 ); > } > return root; > } > /** > * @return The cvs root stored in .cvspass > */ > public String getCvsRootForCvsPass() > { > if ( getUser() != null ) > { > return getCvsRootWithCorrectUser( getUser() ); > } > else > { > if ( AbstractCvsScmProvider.TRANSPORT_LOCAL.equals( > getTransport() ) ) > { > return cvsroot; > } > else > { > throw new IllegalArgumentException( "Username isn't defined." > ); > } > } > } > /** > * @param user user name > * @return > */ > private String getCvsRootWithCorrectUser( String user ) > { > //:transport:rest_of_cvsroot > int indexOfUsername = getTransport().length() + 2; > int indexOfAt = cvsroot.indexOf( "@" ); > String userString = user == null ? "" : ":" + user; > if ( indexOfAt > 0 ) > { > cvsroot = ":" + getTransport() + userString + cvsroot.substring( > indexOfAt ); > } > else > { > cvsroot = ":" + getTransport() + userString + "@" + > cvsroot.substring( indexOfUsername ); > } > return cvsroot; > } > {code} > And if user was set directly, then the getCvsRootWithCorrectUser logic will > be wrong. > So the method should be changed like: > {code:title=CvsScmProviderRepository.java|borderStyle=solid} > /** > * @return The cvs root stored in .cvspass > */ > public String getCvsRootForCvsPass() > { > String result; > String transport = getTransport(); > if ( AbstractCvsScmProvider.TRANSPORT_LOCAL.equals( transport ) ) > { > result = ":" + transport + ":" + cvsroot; > } > else if ( getUser() != null ) > { > result = getCvsRootWithCorrectUser( getUser() ); > } > else > { > throw new IllegalArgumentException( "Username isn't defined." ); > } > return result; > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)