Could not throw exception
I am using SVNKit and the only way to check the authentication on the server is with a testConnection()
class method SVNRepository
.
The method does not return a boolean value, but it throws an exception.
public abstract void testConnection()
throws SVNException
The problem is that instead of catching, I get coldfusion error:
Here is my code:
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 = "";
}
source to share
Well, it is entirely possible that it is throwing an exception that is not Exception
- another type Throwable
. You could catch Throwable
, although that would be pretty harsh ... catching it once by throwing the exact type of exception and then catching that would be smart though ...
source to share