Java SVNKit对auth文件夹的使用
我正在使用Java SVNKit对auth文件夹的使用,java,svnkit,Java,Svnkit,我正在使用SVNKit(1.8.4)从不同的存储库、不同的服务器和不同的协议中检索日志(仅日志)。整个过程在Tomcat服务器上运行,每2分钟查询一次每个SVN服务器的更改 经过大量的尝试和错误,我提出了一个方案,在这个方案中,我为每个SVN客户端实例创建了一个文件夹,以便它可以将所有凭证等存储在自己的隔离位置 下面是创建SVNRepository对象的相关代码: SVNRepository getRepository(String url,
SVNKit
(1.8.4)从不同的存储库、不同的服务器和不同的协议中检索日志(仅日志)。整个过程在Tomcat
服务器上运行,每2分钟查询一次每个SVN
服务器的更改
经过大量的尝试和错误,我提出了一个方案,在这个方案中,我为每个SVN
客户端实例创建了一个文件夹,以便它可以将所有凭证等存储在自己的隔离位置
下面是创建SVNRepository
对象的相关代码:
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;
}
有更好的方法吗?我建议使用轻量级BasicAuthenticationManager实例代替DefaultSVNAuthenticationManager实例。BasicAuthenticationManager仅支持内存中的用户凭据,不使用本地设置或配置文件 代码如下所示:
ISVNAuthenticationManager authManager =
new BasicAuthenticationManager(new SVNAuthentication[] {
new SVNPasswordAuthentication(userName, password,
false, url, false),
});
repository.setAuthenticationManager(authManager);
请看此处:@logoff您发送的链接或多或少描述了相同的问题,但没有提供解决方案。使用DefaultSVNAuthenticationManager时,即使我在Windows计算机中输入了错误的密码,代码仍会继续执行。。在linux机器上,我得到了这个URL“issues.tmatesoft.com/issue/SVNKIT-290”中提到的错误;你的代码能解决这个问题吗??