[udig-devel] Classloader bugs in RC8

Jesse Eichar jeichar at refractions.net
Wed Sep 26 06:17:16 PDT 2007


Ah my bad I misunderstood you.  That definately sounds like a bug.   
I'll certainly check it out.

Jesse

On Sep 25, 2007, at 11:25 PM, tony.roth at GMX.de wrote:

> I know what you want but in the listed classes you don't store the  
> context classloader.
>
> Your code (e.g. ShpPlugin#45 (RC8)):
> ClassLoader current = getClass().getClassLoader();
> ... and then in #73
> Thread.currentThread().setContextClassLoader(current).
> Now you don't have the old context classloader. You have the  
> classloader which has loaded the ShpPlugin class.
> #45 has to be:
> ClassLoader current = Thread.currentThread().getContextClassLoader();
>
> I checked the RC8 code and found this mistake in the classes listed  
> in my first mail. In some other classes you made it correct.
>
> tony roth
>
>
> -----udig-devel-bounces at lists.refractions.net schrieb: -----
>
>
> Hi Tony,
>
> The Classloader stuff is done because in certain cases we don't  
> want to use the eclipse classloader.  As you've probably know the  
> classloader is one that enforces the restrictions declared by the  
> plugins and does the auto loading of dependencies.  So when we need  
> a "normal" classloader (or a special one for that matter).  We have  
> to store the context class loader, make the switch so we can make  
> our changes (in these cases change the logging levels in the  
> Geotools code which is in the net.refractions.lib classloader) and  
> then in the finally block set the context loader back to its  
> original.  Remember that the try finally is critical.  If you start  
> running around with the wrong classloader you're going to be in big  
> trouble.
>
> Jesse
>
>
>
>
> On Sep 25, 2007, at 5:33 AM, tony.roth at GMX.de wrote:
>
>> Due to other issues we use still the RC8 SDK and found this:
>> In the following classes
>> ShpPlugin
>> WfsPlugin
>> BasicFeatureRenderer
>> RendererPlugin
>> ShapefileFeatureRenderer
>> BasicWMSRenderer
>> the ClassLoader has to be saved with
>> ClassLoader current = Thread.currentThread().getContextClassLoader();
>> instead of using the classloader of the respective class.
>> I don't know if it's already fixed in a newer version. With RC8 we  
>> got strange exceptions since the classloader of some Eclipse  
>> Worker Objects (started out of udig classes) was not the same we  
>> needed for our RMI communication.
>> tony roth
>> _______________________________________________
>> User-friendly Desktop Internet GIS (uDig)
>> http://udig.refractions.net
>> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.refractions.net/pipermail/udig-devel/attachments/20070926/4fb4ec22/attachment-0001.html


More information about the udig-devel mailing list