我正在使用 SVNKit,我发现测试服务器身份验证的唯一方法是使用testConnection()
class的方法SVNRepository
。
该方法不返回布尔值,但会引发异常。
public abstract void testConnection()
throws SVNException
问题是,我得到一个coldfusion错误,而不是被抓住:
这是我的代码:
clientManager = CreateObject("java", "org.tmatesoft.svn.core.wc.SVNClientManager").newInstance();
authManagerJO = CreateObject("java", "org.tmatesoft.svn.core.wc.SVNWCUtil").
createDefaultAuthenticationManager(ARGUMENTS.username, JavaCast("String", ARGUMENTS.password));
authManagerJO.setAuthenticationForced(true);
clientManager.setAuthenticationManager(authManagerJO);
svnDavRepoFactory = CreateObject("java", "org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory").setup();
repositoryUrlJO = CreateObject("java", "org.tmatesoft.svn.core.SVNURL").parseURIDecoded(APPLICATION.svn_repository_audifiles);
svnRepository = clientManager.createRepository(repositoryUrlJO, true);
try{
svnRepository.testConnection();
}
catch (Exception e){
svnRepository = "";
}