This implementation can easily be broken with inputs like `:workspaceName` or `repositoryName:` or even an empty string. They may be unlikely, but it might be better to create more fault-tolerant code. I'm not sure what the behavior should be in this case, but here's an example that assumes that the repository


    CheckArg.isNotNull(repositoryId,"repositoryId");  // if can be user-supplied, or 'assert repositoryId != null' if not user supplied
    repositoryId = repositoryId.trim();
    String[] parts = repositoryId.split(":");
    int numParts = parts.length;
    if (numParts > 1) {
        // Just deal with the first two parts ...
        return parts[0].trim().length() != 0 ? parts[0].trim() : parts[1].trim();    // may be blank
    }
    return repositoryId;

What do you think?