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

[Subclipse-dev] unavailable JavaSVN causes NoClassDefFoundError

From: Oliver Niekrenz <oliver_at_niekrenz.de>
Date: 2006-10-16 12:12:12 CEST

Sorry, I used the wrong account in my first email.

> I suggest moving the isAvailable() method of javahl
> to it's factory too, for reasons of uniformity.

Well, same thing happens when javahl is not available.
The isAvailable() must be moved elsewhere, I suggest from JhlClientAdapter to JhlClientAdapterFactory as JhlClientAdapter depends on javahl classes which will not be found as soon as JhlClientAdapter is used.

Move the fields availabilityCached, available and javaHLErrors to JhlClientAdapterFactory, too
Copy getLibraryLoadErrors() to JhlClientAdapterFactory and mark it deprecated in JhlClientAdapter.
What about a general getLoadErrors for the factories?

JhlClientAdapterFactory:
    public static boolean isAvailable() {
        if (!availabilityCached) {
            Class cClient = null;
            try {
                cClient = Class.forName("org.tigris.subversion.javahl.SVNClient");
            } catch (Throwable t) {
                availabilityCached = true;
                return false;
            }
        ...
                if(AbstractClientAdapter.isOsWindows()) {
        ...
                // At this point, the library appears to be available, but
                // it could be a 1.2.x version of JavaHL. We have to try
                // to execute a 1.3.x method to be sure.
                try {
                    //SVNClientInterface svnClient = new SVNClient();
                    //String dirname = svnClient.getAdminDirectoryName();
                    Object svnClient = Class.newInstance();
                    String dirname = (String)cClient.getMethod("getAdminDirectoryName", null).invoke(svnClient, null);
               // to remove compiler warning about dirname not being read
                    if (dirname != null)
                        available = true;
                } catch (Throwable t) {
    ...

    public static void setup() throws SVNClientException {
        if (!isAvailable()) {
            throw new SVNClientException("Javahl client adapter is not available");
        }
        
        SVNClientAdapterFactory.registerAdapterFactory(new JhlClientAdapterFactory());
    }

Regards,
Oliver

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subclipse.tigris.org
For additional commands, e-mail: dev-help@subclipse.tigris.org
Received on Mon Oct 16 12:12:19 2006

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