Return-Path: Delivered-To: apmail-geronimo-xbean-dev-archive@locus.apache.org Received: (qmail 91563 invoked from network); 18 Oct 2007 13:13:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Oct 2007 13:13:41 -0000 Received: (qmail 19205 invoked by uid 500); 18 Oct 2007 13:13:29 -0000 Delivered-To: apmail-geronimo-xbean-dev-archive@geronimo.apache.org Received: (qmail 19182 invoked by uid 500); 18 Oct 2007 13:13:29 -0000 Mailing-List: contact xbean-dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: xbean-dev@geronimo.apache.org Delivered-To: mailing list xbean-dev@geronimo.apache.org Received: (qmail 19173 invoked by uid 99); 18 Oct 2007 13:13:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2007 06:13:29 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Oct 2007 13:13:41 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 151A871422E for ; Thu, 18 Oct 2007 06:12:51 -0700 (PDT) Message-ID: <23961500.1192713171083.JavaMail.jira@brutus> Date: Thu, 18 Oct 2007 06:12:51 -0700 (PDT) From: "Christopher Sahnwaldt (JIRA)" To: xbean-dev@geronimo.apache.org Subject: [jira] Commented: (XBEAN-95) register PropertyEditors locally, not globally In-Reply-To: <12469606.1192711190777.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/XBEAN-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12535910 ] Christopher Sahnwaldt commented on XBEAN-95: -------------------------------------------- I think this can be fixed by a small change in org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.registerCustomEditors(). Current version (SVN revision 517909): /** * Registers whatever custom editors we need */ public static void registerCustomEditors(DefaultListableBeanFactory beanFactory) { PropertyEditorHelper.registerCustomEditors(); } New version: /** * Registers whatever custom editors we need */ public static void registerCustomEditors(DefaultListableBeanFactory beanFactory) { PropertyEditorRegistrar registrar = new PropertyEditorRegistrar() { public void registerCustomEditors( PropertyEditorRegistry registry ) { registry.registerCustomEditor(java.io.File.class, new org.apache.xbean.spring.context.impl.FileEditor()); registry.registerCustomEditor(java.net.URI.class, new org.apache.xbean.spring.context.impl.URIEditor()); registry.registerCustomEditor(java.util.Date.class, new org.apache.xbean.spring.context.impl.DateEditor()); registry.registerCustomEditor(javax.management.ObjectName.class, new org.apache.xbean.spring.context.impl.ObjectNameEditor()); } }; beanFactory.addPropertyEditorRegistrar(registrar); } Two new imports are needed: import org.springframework.beans.PropertyEditorRegistrar; import org.springframework.beans.PropertyEditorRegistry; PropertyEditorHelper.registerCustomEditors() is also called by the static initializers of org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate and org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler. I would think that these static initializers can simply be removed, but I'm not sure. > register PropertyEditors locally, not globally > ---------------------------------------------- > > Key: XBEAN-95 > URL: https://issues.apache.org/jira/browse/XBEAN-95 > Project: XBean > Issue Type: Bug > Components: spring > Reporter: Christopher Sahnwaldt > > org.apache.xbean.spring.context.impl.PropertyEditorHelper registers PropertyEditors for java.io.File, java.net.URI, java.util.Date and javax.management.ObjectName using java.beans.PropertyEditorManager.registerEditor(). This may cause problems: > - the usual problem with global variables: another application running in the same JVM may register a different PropertyEditor, e.g. for java.util.Date. One of the applications will then use the PropertyEditor that was registered by the other application. Which application 'wins' depends on the order of the calls to PropertyEditorManager.registerEditor(). > - java.beans.PropertyEditorManager keeps a strong reference to the registered classes. The xbean PropertyEditor classes are loaded by the context class loader, (which is the webapp class loader if running in Tomcat etc.). The class java.beans.PropertyEditorManager is loaded by the bootstrap class loader. This means that there is a strong reference from the bootstrap class loader to the webapp class loader, which means that the webapp class loader cannot be unloaded, which means that the webapp is not garbage collected when it is undeployed. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.