1

I am using svnkit (standalone 1.8.12) to checkout an svn repository with java. I tried several possibilities to do so (1, 2). Unfortunately, as soon as SVNkit starts to connect to the SVN server it crashes with the following stack trace (checkout, test connection, get revision number and so on). Checkout via terminal works just fine (using Ubuntu 14 with subversion installed), also open the used repo-url with a browser works just fine.

Exception in thread "main" java.lang.IndexOutOfBoundsException: Bounds exceeds available space : size=7, offset=8
at com.sun.jna.Memory.boundsCheck(Memory.java:185)
at com.sun.jna.Memory.getPointer(Memory.java:509)
at org.tmatesoft.svn.core.internal.util.jna.SVNGnomeKeyring.setPassword(SVNGnomeKeyring.java:334)
at org.tmatesoft.svn.core.internal.util.jna.SVNGnomeKeyring.setPassword(SVNGnomeKeyring.java:308)
at org.tmatesoft.svn.core.internal.util.jna.SVNJNAUtil.addPasswordToGnomeKeyring(SVNJNAUtil.java:170)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNPersistentAuthenticationProvider$GnomeKeyringPasswordStorage.savePassword(DefaultSVNPersistentAuthenticationProvider.java:696)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNPersistentAuthenticationProvider.savePasswordCredential(DefaultSVNPersistentAuthenticationProvider.java:416)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNPersistentAuthenticationProvider.saveAuthentication(DefaultSVNPersistentAuthenticationProvider.java:323)
at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.acknowledgeAuthentication(DefaultSVNAuthenticationManager.java:274)
at org.tmatesoft.svn.core.auth.BasicAuthenticationManager.acknowledgeAuthentication(BasicAuthenticationManager.java:105)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:771)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:398)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:386)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:863)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:699)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:118)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1049)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.testConnection(DAVRepository.java:100)
at Main.svnCheckout(Main.java:131)
at Main.svnCheckoutPrep(Main.java:106)
at Main.main(Main.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

The code that produces this error is the following

    static void svnCheckout(String url, String dest) throws SVNException {
    /* Setup SVNKIT library */
    setupSVNKit();

    SVNRepository repository = null;
    try {
        repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
    } catch (SVNException svne) {
        System.err.println("error while creating an SVNRepository for the location '"
                        + url + "': " + svne.getMessage());
        System.exit(1);
    }
    ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("someName", "somePWD");
    repository.setAuthenticationManager(authManager);
    repository.testConnection();
    }

...

    static void setupSVNKit(){
    /* For using http:// and https:// */
    DAVRepositoryFactory.setup();
    }

Does anyone have an idea what I do wrong? I would be so happy, if only the testConnection() function would work. Since it is https, do I need to setup SVNkit to accept the fingerprint or similar?

Any help is highly appreciated! markus

Community
  • 1
  • 1
markus
  • 41
  • 5

1 Answers1

2

Alright, after many trials and errors I figured it out. Actually, I run into a different error using another repository. I did two things (not sure which one was the actual reason, maybe both of them).

  1. Added the untrusted certificate (yes it was not validated) to the JVM
  2. Added the following line to the VM options: -Dsvnkit.library.gnome-keyring.enabled=false

Further Reading:

Point 1: https://issues.tmatesoft.com/issueMobile/SVNOLD-290

Point 2: https://issues.tmatesoft.com/issue/SVNKIT-231

markus
  • 41
  • 5