Fra*_*s P 3 java coldfusion exception-handling svnkit coldfusion-8
我正在使用SVNKit,我发现测试Authentification到服务器的唯一方法是使用testConnection()
类的方法SVNRepository
.
该方法不返回布尔值但抛出异常.
public abstract void testConnection()
throws SVNException
Run Code Online (Sandbox Code Playgroud)
问题是,我得到了一个冷血错误,而不是被捕获:
这是我的代码:
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 = "";
}
Run Code Online (Sandbox Code Playgroud)
嗯,它完全有可能抛出一个不是Exception
另一种例外Throwable
.你可以抓住Throwable
,虽然那会非常苛刻......抓住它一次,记录确切的异常类型,然后抓住那将是合理的虽然......
归档时间: |
|
查看次数: |
658 次 |
最近记录: |