1

I'm using SVNKit (1.8.4) to retrieve logs (only the logs) from different repositories, on different servers, with different protocols. The whole thing runs on a Tomcat server and is querying each SVN server every 2 minutes for changes.

After a lot of trial and error, I came up with a scheme where I make a folder for each SVN client instance, so that it can store all the credentials etc. in its own isolated place.

Here's the relevant code that creates the SVNRepository object:

SVNRepository getRepository(String url,
                                String authFolder,
                                    String username,
                                        String password)
                                            throws SVNException {
    SVNRepository repository =
        SVNRepositoryFactory.create( SVNURL.parseURIEncoded(url) );  
    ISVNAuthenticationManager authManager =
        SVNWCUtil.createDefaultAuthenticationManager(
                      authFolder, username, password, true);
    repository.setAuthenticationManager(authManager);
    return repository;
}

Is there a better way to do this?

2
  • take a look here: subversion.1072662.n5.nabble.com/… Commented Jun 27, 2014 at 10:22
  • @logoff the link you sent describes more or less the same problem, and doesn't provide a solution. Commented Jun 27, 2014 at 11:53

1 Answer 1

3
+50

I'd suggest to use lightweight BasicAuthenticationManager instance in place of DefaultSVNAuthenticationManager one. BasicAuthenticationManager only users in-memory credentials and doesn't use local settings or configuration files.

The code would look like that:

ISVNAuthenticationManager authManager = 
  new BasicAuthenticationManager(new SVNAuthentication[] {
        new SVNPasswordAuthentication(userName, password, 
                                      false, url, false),
  });
repository.setAuthenticationManager(authManager);
Sign up to request clarification or add additional context in comments.

1 Comment

While using DefaultSVNAuthenticationManager the code execution continues even when I enter the wrong password in Windows machine.. On linux machine i get the error mentioned in this URL "issues.tmatesoft.com/issue/SVNKIT-290"; Will your code solve that problem??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.