classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Native library class loader fixes


From: Archie Cobbs
Subject: Re: [cp-patches] Native library class loader fixes
Date: Tue, 04 Jan 2005 10:35:14 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

Jeroen Frijters wrote:
> Thanks. I wouldn't make this change though:
> 
> -           throw new UnsatisfiedLinkError("Could not load library " +
> filename);
> -          }
> +         throw new UnsatisfiedLinkError("Could not find library " +
> libname);
> 
> The nicest would actually be to include both names in the exception
> message.

Yes.. how's this:

   void loadLibrary(String libname, ClassLoader loader)
   {
     SecurityManager sm = SecurityManager.current; // Be thread-safe!
     if (sm != null)
       sm.checkLink(libname);
     String filename;
     if (loader != null && (filename = loader.findLibrary(libname)) != null)
       {
         if (loadLib(filename, loader) != 0)
           return;
       }
     else
       {
         filename = VMRuntime.mapLibraryName(libname);
         for (int i = 0; i < libpath.length; i++)
           if (loadLib(libpath[i] + filename, loader) != 0)
             return;
       }
     throw new UnsatisfiedLinkError("Native library `" + libname
       + "' not found (as file `" + filename + "')");
   }

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


*
Confidentiality Notice: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message.
*





reply via email to

[Prev in Thread] Current Thread [Next in Thread]