Continuum

DefaultContinuumScm.getScmRepository should not set project scm username/password if they are the empty string

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.0.3
  • Component/s: Core system
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

Should be using StringUtils.isEmpty instead of doing a null check.

if ( !StringUtils.isEmpty(project.getScmUsername()) )
{
    providerRepository.setUser( project.getScmUsername() );

    if ( project.getScmPassword() != null )
    {
        providerRepository.setPassword( project.getScmPassword() );
    }
    else
    {
        providerRepository.setPassword( "" );
    }
}

Activity

Hide
Trygve Laugstol added a comment -

Why?

Show
Trygve Laugstol added a comment - Why?
Hide
Emmanuel Venisse added a comment -

It's already what we have

Show
Emmanuel Venisse added a comment - It's already what we have
Hide
John Didion added a comment -

I looked at the trunk version and it's still doing a null check instead of StringUtils.isEmpty. The reason why this is broken is the following:

1. Add a project
2. Edit project info, but leave scm username/password blank
3. The empty string gets stored in the DB for username and password (formica should probably be interpreting an empty field as null, or at least be able to be configured to do this)
4. When doing a checkout using perforce, the repository username is used in constructing the specname. If the username is blank, it results in an invalid specname. If the username is null, it just uses the user.name system property, which is the desired behavior.

Show
John Didion added a comment - I looked at the trunk version and it's still doing a null check instead of StringUtils.isEmpty. The reason why this is broken is the following: 1. Add a project 2. Edit project info, but leave scm username/password blank 3. The empty string gets stored in the DB for username and password (formica should probably be interpreting an empty field as null, or at least be able to be configured to do this) 4. When doing a checkout using perforce, the repository username is used in constructing the specname. If the username is blank, it results in an invalid specname. If the username is null, it just uses the user.name system property, which is the desired behavior.
Hide
Emmanuel Venisse added a comment -

code in trunk isn't the latest. I must merge code from continuum-1.0.x branch.

Show
Emmanuel Venisse added a comment - code in trunk isn't the latest. I must merge code from continuum-1.0.x branch.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: