Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 99566 invoked from network); 9 Sep 2003 18:01:20 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 9 Sep 2003 18:01:20 -0000 Received: (qmail 74524 invoked by uid 500); 9 Sep 2003 18:00:59 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 74454 invoked by uid 500); 9 Sep 2003 18:00: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 Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 74375 invoked from network); 9 Sep 2003 18:00:54 -0000 Received: from unknown (HELO smtpzilla5.xs4all.nl) (194.109.127.141) by daedalus.apache.org with SMTP; 9 Sep 2003 18:00:54 -0000 Received: from pt (a213-84-18-216.adsl.xs4all.nl [213.84.18.216]) by smtpzilla5.xs4all.nl (8.12.9/8.12.9) with SMTP id h89HTH0r098768 for ; Tue, 9 Sep 2003 19:29:17 +0200 (CEST) From: "Hugo Burm" To: Subject: RE: "Remove" problems with the Woody sample Date: Tue, 9 Sep 2003 19:29:15 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <1063098275.22513.189.camel@yum.ot> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N > -----Original Message----- > From: Bruno Dumon [mailto:bruno@outerthought.org] > Sent: Tuesday, September 09, 2003 11:05 AM > To: dev@cocoon.apache.org > Subject: Re: "Remove" problems with the Woody sample > > > On Sat, 2003-09-06 at 13:39, Hugo Burm wrote: > > This is about the "Bean Binding" sample on the Woody samples > page, and the > > "Remove" option of the Contacts on this page. > > (Cocoon version: 2.1.2, one day after the release of 2.1.1) > > > > 1) > > If I have more than one Contact (e.g. by adding the lines > > contact = new Packages.org.apache.cocoon.woody.samples.Contact(); > > contact.setId("2"); > > contact.setFirstName("Hugo"); > > bean.addContact(contact); > > to the "form2bean" function in "binding_example.js"), > > I cannot delete more than one at a time. When I check two > Contacts, Click on > > "Remove selected contacts", then only one of them is removed. > > You mean that only one is removed _after performing the binding_, right? > They are both removed from the repeater-widget, but there's something > wrong in the repeater binding indeed. It doesn't work for binding to XML > documents either. Yes, that is wat I meant. After pressing "Submit Query", one of the two contacts that was just removed by the repeater, re-appears. Sorry for not explaining that clearly. > > This seems to be caused by the classical problem when removing items > from a list while running through it. > > I've tried to solve this by first storing the JXPathContexts of the > items to delete in a seperate list, and then running backwards through > that list, and it seems to work all right. Will commit this soon. > > Thanks for reporting this problem! > Thanks for repairing it. > > > > 2) > > The Contacts are not removed from the ArrayList. By the Remove > option, all > > relevant keys of the Contact are set to null, so you will never > see it again > > in this context. But the item is not removed from the list. This is a > > problem if you have a persistence framework flushing the list > to hard disk > > (zombie records in your database). > > > > Not sure that I follow here: I suppose that if I don't see the item > anymore on jx-generated page, it really isn't in the arraylist anymore? > Because this occured both for the standaard Woody repeater and for my own map-repeater which uses Maps instead of ArrayLists, I concluded it was a Woody problem. But now I did some additionally checks, it looks like it is a Hibernate problem. Hibernate is doing runtime reflection: it replaces the instances of the classes like Maps, Lists, Sets with its own instances in order to do its O/R mapping. May be there is a problem with JXPath. I have to post this to some other list. > > > > I checked the Woody source. I guess it must be the JXPath > removePath() in > > DeleteNodeJXPathBinding.java. > > What is this removePath() supposed to do? > > Remove the addressed path. If it addresses an item in a collection, it > means removing the item from the collection. That was what I was wondering about: does it actually remove it from the Collection, or does it just set all keys to null, like it is doing in my environment. But now I have some obvious suspects for the latter behaviour (the combination of Hibernate annd JXPath) > > -- > Bruno Dumon http://outerthought.org/ > Outerthought - Open Source, Java & XML Competence Support Center > bruno@outerthought.org bruno@apache.org > > Hugo Burm