Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 97413 invoked from network); 7 Oct 2006 06:05:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Oct 2006 06:05:00 -0000 Received: (qmail 28945 invoked by uid 500); 7 Oct 2006 06:04:58 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 28879 invoked by uid 500); 7 Oct 2006 06:04:58 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 28868 invoked by uid 99); 7 Oct 2006 06:04:57 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Oct 2006 23:04:57 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [209.237.227.198] ([209.237.227.198:57774] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id D6/F4-24193-F7347254 for ; Fri, 06 Oct 2006 23:04:48 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 75E8B7141F2 for ; Fri, 6 Oct 2006 23:04:21 -0700 (PDT) Message-ID: <23441058.1160201061480.JavaMail.root@brutus> Date: Fri, 6 Oct 2006 23:04:21 -0700 (PDT) From: "Antonio Gallardo (JIRA)" To: dev@cocoon.apache.org Subject: [jira] Assigned: (COCOON-1867) BeanConvertor uses a WeakHashMap in the wrong way. In-Reply-To: <8232556.1150812449790.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/COCOON-1867?page=all ] Antonio Gallardo reassigned COCOON-1867: ---------------------------------------- Assignee: Antonio Gallardo (was: Simone Gianni) > BeanConvertor uses a WeakHashMap in the wrong way. > -------------------------------------------------- > > Key: COCOON-1867 > URL: http://issues.apache.org/jira/browse/COCOON-1867 > Project: Cocoon > Issue Type: Bug > Components: Blocks: Forms > Affects Versions: 2.1.9, 2.1.10-dev (current SVN) > Reporter: Simone Gianni > Assigned To: Antonio Gallardo > Priority: Critical > Attachments: BeanConvertor-1867.diff > > > In the BeanConvertor, when a bean is converted to a string, the bean is stored in a WeakHashMap this way : > m_objects.put(idValue, value); > Actually idValue is a string representing the bean (toString or evalued on id_path) while the value is the bean. > WeakHashMap DOES NOT remove a mapping when the bean is garbage collected, but actually removes it when the KEY is garbage collected. This means that since the string is serialized to XML in the form instance and then dropped, the mapping could be removed even while the user is filling the form, with the conseguence that the convertor stops working, see a null value, reports a validation error, even if the user correctly filled the form. > This is even worse when you are using a selection list of beans, because in that case the bean has no chanches to enter the m_objects map anymore, since the selection list has been generated and stored st the beginning of the form (maybe thru flow, or on-create) and is not asking the convertor to convert the beans anymore. > A better solution (and IMMO what the author intended to do) is to remove the mapping (so that the map does not hold references for everything) when the BEAN gets garbage collected. In this case I'm experimenting with apache commons ReferenceMap, which actually can remove mappings when the value (bean) is garbage collected. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira