我正在使用svnkit(独立版1.8.12)使用java签出svn存储库。 我尝试了几种可能性(1,2)。不幸的是,一旦SVNkit开始连接到SVN服务器,它就会崩溃,并带有以下堆栈跟踪(checkout,test connection,get revision number等)。通过终端检查工作正常(使用安装了Subversion的Ubuntu 14),也可以使用浏览器打开使用过的repo-url。
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)
产生此错误的代码如下
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();
}
有谁知道我做错了什么? 如果只有testConnection()函数可以工作,我会很高兴。 由于它是https,我是否需要设置SVNkit以接受指纹或类似的?
非常感谢任何帮助! 马库斯
答案 0 :(得分:2)
好吧,经过多次试验和错误,我发现了它。实际上,我使用另一个存储库遇到了不同的错误。我做了两件事(不确定哪一个是真正的原因,也许两者都是)。
-Dsvnkit.library.gnome-keyring.enabled=false
进一步阅读: