[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Problem in JavaHL library initialization

From: Conor MacNeill <conor_at_cenqua.com>
Date: 2005-08-02 16:44:21 CEST

The static initializer in SvnClient.java has a problem. If the load of
the specifiedLibraryName succeeds, the code will still attempt to load
from the standard locations. The exception thrown by the final attempt
is not caught and initialization fails, even though the specified
library may have been loaded successfully. Inserting a return after a
successful load in the first try block would fix this.

I've annotated the current code below with "// ++++++++".

Conor

    static
    {
        /*
         * see if the user has specified the fully qualified path to the
         * native library
         */
        try
        {
            String specifiedLibraryName =
                    System.getProperty("subversion.native.library");
            if(specifiedLibraryName != null)
                System.load(specifiedLibraryName);
            // ++++++++ insert return here
        }
        catch(UnsatisfiedLinkError ex)
        {
            // ignore that error to try again
        }
        /*
         * first try to load the library by the new name.
         * if that fails, try to load the library by the old name.
         */
        try
        {
            System.loadLibrary("svnjavahl-1");
        }
        catch(UnsatisfiedLinkError ex)
        {
            try
            {
                System.loadLibrary("libsvnjavahl-1");
            }
            catch (UnsatisfiedLinkError e)
            {
                System.loadLibrary("svnjavahl");
                // ++++++++ exception thrown from here.
            }
        }
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 2 16:45:24 2005

This is an archived mail posted to the Subversion Dev mailing list.