Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String retrieveRealmFor(String scmURL){
- final String[] realms = new String[]{ null };
- SVNRepository repository;
- try {
- repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(scmURL));
- repository.setTunnelProvider(SVNWCUtil.createDefaultOptions(true));
- repository.setAuthenticationManager(new DefaultSVNAuthenticationManager(SVNWCUtil.getDefaultConfigurationDirectory(), true, "", "", null, "") {
- @Override
- public SVNAuthentication getFirstAuthentication(String kind, String realm, SVNURL url) throws SVNException {
- realms[0] = realm;
- return super.getFirstAuthentication(kind, realm, url);
- }
- @Override
- public SVNAuthentication getNextAuthentication(String kind, String realm, SVNURL url) throws SVNException {
- realms[0] = realm;
- return super.getNextAuthentication(kind, realm, url);
- }
- @Override
- public void acknowledgeAuthentication(boolean accepted, String kind, String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication) throws SVNException {
- realms[0] = realm;
- super.acknowledgeAuthentication(accepted, kind, realm, errorMessage, authentication);
- }
- });
- repository.testConnection();
- } catch (SVNException e) {
- // If a problem happens, don't do anything, it implies realm doesn't exist in current cache
- }
- return realms[0];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement