On 06/03/09 19:58, Marcin Miłkowski wrote:
Oliver Brinzing pisze:
Hi Marcin,

Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

yes this seems to help, classloader was indeed null ...

may i add your solution to issue http://www.openoffice.org/issues/show_bug.cgi?id=102164 ?

Go ahead, but I wouldn't call this a solution, this is almost a hack.

Setting the context class loader to an appropriate value around code that uses it is not a hack but rather mandatory coding work. (The context class loader concept itself is the hack, in my not so humble opinion.) See <http://www.openoffice.org/issues/show_bug.cgi?id=102164#desc7> for what I think happens here.

(If the fix for <http://www.openoffice.org/issues/show_bug.cgi?id=99290> turns out to break too much existing code, we might want to reconsider it, however.)

One more thing: first check if the classloader is null, because if it isn't, you will get into trouble (as we did).

Out of curiosity, what kind of trouble did you get into (assuming you re-set the context class loader to its originally value after calling the code that used it)?

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to