directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karsten Baensch (JIRA)" <>
Subject [jira] Created: (DIRSTUDIO-585) Do not modify the current thread's ClassLoader; or reset it afterwards
Date Tue, 10 Nov 2009 21:45:27 GMT
Do not modify the current thread's ClassLoader; or reset it afterwards

                 Key: DIRSTUDIO-585
             Project: Directory Studio
          Issue Type: Bug
          Components: studio-ldapbrowser
    Affects Versions: 1.5.0, 1.4.0
            Reporter: Karsten Baensch


in BrowserConnectionManager.load
and in
Utils.serialize / deserialize
we recognized that the ClassLoader is modified without conserving / resetting it to the previous
one at the end.
This conflicted with our class loading mechanisms ... streaming from our own class store.

As a quick fix for testing, we could do for example the following; however, this is not a
real solution:

    public static String serialize( Object o )
    	String s = null;
        Thread cur_thrd = Thread.currentThread(); //patch reset current class loader
        ClassLoader cur_thrd_cl = cur_thrd.getContextClassLoader();
	        cur_thrd.setContextClassLoader( Utils.class.getClassLoader() );
	        ByteArrayOutputStream baos = new ByteArrayOutputStream();
	        XMLEncoder encoder = new XMLEncoder( baos );
	        encoder.writeObject( o );
	        s = LdifUtils.utf8decode( baos.toByteArray() );
        return s;

=> Is there a better way?

Thanks and regards,

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message