From dev-return-32851-apmail-directory-dev-archive=directory.apache.org@directory.apache.org Mon Mar 08 12:58:13 2010 Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 35067 invoked from network); 8 Mar 2010 12:58:12 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Mar 2010 12:58:12 -0000 Received: (qmail 30156 invoked by uid 500); 8 Mar 2010 12:57:49 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 30116 invoked by uid 500); 8 Mar 2010 12:57:49 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 30107 invoked by uid 99); 8 Mar 2010 12:57:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Mar 2010 12:57:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Mar 2010 12:57:47 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2D4B1234C1EE for ; Mon, 8 Mar 2010 12:57:27 +0000 (UTC) Message-ID: <1080664450.134591268053047184.JavaMail.jira@brutus.apache.org> Date: Mon, 8 Mar 2010 12:57:27 +0000 (UTC) From: "Stefan Seelmann (JIRA)" To: dev@directory.apache.org Subject: [jira] Commented: (DIRSTUDIO-585) Do not modify the current thread's ClassLoader; or reset it afterwards In-Reply-To: <1508679271.1257889527981.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DIRSTUDIO-585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842646#action_12842646 ] Stefan Seelmann commented on DIRSTUDIO-585: ------------------------------------------- Thanks Karsten for the proposed workaround. I think we should get rid of the XMLEncoder at all. In Utils it is used to store some preferences and I was to lazy to build our own Object<->XML mapping. I'll add your proposed workaround here. In BrowserConnectionManager it is only used for backward compatibility to be able to convert old connections.xml format. I think we use the new file format since 1.0. So the code in this class should never be executed. Let's remove the legacy code with Studio 2.0 > Do not modify the current thread's ClassLoader; or reset it afterwards > ---------------------------------------------------------------------- > > Key: DIRSTUDIO-585 > URL: https://issues.apache.org/jira/browse/DIRSTUDIO-585 > Project: Directory Studio > Issue Type: Bug > Components: studio-ldapbrowser > Affects Versions: 1.4.0, 1.5.0 > Reporter: Karsten Baensch > > Hi, > 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(); > try{ > cur_thrd.setContextClassLoader( Utils.class.getClassLoader() ); > ByteArrayOutputStream baos = new ByteArrayOutputStream(); > XMLEncoder encoder = new XMLEncoder( baos ); > encoder.writeObject( o ); > encoder.close(); > s = LdifUtils.utf8decode( baos.toByteArray() ); > }finally{ > cur_thrd.setContextClassLoader(cur_thrd_cl); > } > return s; > } > => Is there a better way? > Thanks and regards, > Karsten -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.