subversion-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marek Parfianowicz (JIRA)" <>
Subject [jira] [Commented] (SVN-4628) Classes with native methods unnecessarily load the svnjavahl-1 native library
Date Fri, 22 Apr 2016 09:33:12 GMT


Marek Parfianowicz commented on SVN-4628:

Hi Branko,

Yes, I agree, there were static initialisers loading the native library before. But this native
library was loaded only when given class was loaded by a classloader, which means at the first
use of given class. Which means, that in case of SVNKit, it never loaded because that code
was never executed.

The exact problem we have is that we simply want to check the SVN client version:

SVNClient client = new SVNClient();
Version version = client.getVersion();

The SVNKit implementation provides it's own SVNClientImplVersion class, which extends the
Version class and provides Java implementations of native methods declared in the Version

Thus before SVN 1.9.0 it was possible to check SVN client version without loading the native

Since SVN 1.9.0 it's impossible, because the NativeResources.loadNativeLibrary() call was
added in the Version class. 


> Classes with native methods unnecessarily load the svnjavahl-1 native library
> -----------------------------------------------------------------------------
>                 Key: SVN-4628
>                 URL:
>             Project: Subversion
>          Issue Type: Bug
>          Components: bindings_javahl
>    Affects Versions: 1.9.0, 1.9.1, 1.9.2, 1.9.3
>            Reporter: Marek Parfianowicz
>            Assignee: Branko ─îibej
> In this commit:
> a static code has been added to load the native library to all classes having native
> This is superfluous. Please note that subclasses can provide a non-native implementation
of these native methods. So having a native library is actually not mandatory.
> There's a real problem with SVNKit, which provides a pure Java-based implementation of
SVN protocol, that you cannot use it without having SVN binaries installed. 
> Please have a look at this bug report for SVNKit 1.9.x:
> which actually should be fixed on SVN side...
> ================================================================================
> You have a permission scheme in your JIRA configured incorrectly as I cannot add comments.
So let me answer your questions here:
> bq. (Please provide references to commits in the ASF Subversion repository. The thing
on GitHub is just a read-only mirror and there's no reference to the original revision there.)
> It's this change:
> bq. I added the static initialisers because otherwise those classes would not work correctly.
Loading the native method implementations is not superfluous in any sense; JavaHL does not
provide a mandatory initialisation method that could be used for loading the native library.
> Branko, correct me if I am wrong, but my understanding is that JavaHL (
consists of high level Java API for Subversion and concrete, native, implementation of this
API using core Subversion C API.
> Until subversion 1.9.0 it was possible to use high level API in a way described in
issue, without the need to have native libraries installed on the system.   Since the cs:1525922
change though, those native libraries are required.
> This causes issues in products like Atlassian FishEye, where SVNKit library is bundled
and used out of the box as the Subversion JavaHL implementation.  Seems like change introduced
in subversion 1.9.0 would require us to bundle OS specific native libraries, just to check
the JavaHL version in runtime.  Seems like an overkill, especially knowing that in default
configuration those binaries wouldn't be used anyway as SVNKit implementation will be used.
> bq. JavaHL does not provide a mandatory initialisation method that could be used for
loading the native library.
> I see your concern here, not sure if loading native libraries in every API class is the
best solution to the problem.  Perhaps a JavaDoc explaining the responsibility of the client
to call NativeResources.loadNativeLibrary(); is sufficient?

This message was sent by Atlassian JIRA

View raw message