我完全被我遇到的SVNKit(1.8.5)错误所困扰。我使用以下模式构建了一个Authentication Manager:
public static SVNRepository getSvnRepository(String userName, String pass, String repoURL) throws SVNException
{
SVNRepository repository;
repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(repoURL));
ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(userName, pass);
repository.setAuthenticationManager(authManager);
return repository;
}
我在几个地方使用此模式,以确保用户可以对存储库进行身份验证,获取存储库中所有文件夹的列表,甚至可以浏览子文件夹的顶级以解析存储库文件并构建依赖图。所有这些都成功了。
但是当我尝试运行结账时,我收到了身份验证错误。令人费解的是,这个错误只发生在我们办公室的一台电脑上。运行OS X,Windows和各种版本的Ubuntu的其他几台计算机对此过程没有任何问题,并且可以检查没有问题但运行Ubuntu 12.10的一台特定计算机难以尝试运行以下内容:
SVNRepository repository = getSvnRepository(userName, pass, url + "/" + subfolder);
SvnOperationFactory factory = new SvnOperationFactory();
SvnCheckout checkout = factory.createCheckout();
checkout.setSource(SvnTarget.fromURL(repository.getLocation()));
checkout.setSingleTarget(SvnTarget.fromFile(location.resolve(project).toFile()));
checkout.run();
堆栈跟踪:
org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: Authentication required for '<https://[snip]:443>'
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:47)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:41)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:186)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:682)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:371)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:359)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:710)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:627)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:102)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1032)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.getLatestRevision(DAVRepository.java:175)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgRepositoryAccess.getRevisionNumber(SvnNgRepositoryAccess.java:118)
at org.tmatesoft.svn.core.internal.wc2.SvnRepositoryAccess.getLocations(SvnRepositoryAccess.java:182)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgRepositoryAccess.createRepositoryFor(SvnNgRepositoryAccess.java:45)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgAbstractUpdate.checkout(SvnNgAbstractUpdate.java:756)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgCheckout.run(SvnNgCheckout.java:16)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgCheckout.run(SvnNgCheckout.java:10)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgOperationRunner.run(SvnNgOperationRunner.java:20)
at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:20)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1149)
at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294)