cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <giac...@apache.org>
Subject Re: [jira] Commented: (COCOON-1689) Cannot save a cform containing a multivalued field with more than 9 values !
Date Tue, 22 Nov 2005 16:14:02 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 22 Nov 2005, Sylvain Wallez (JIRA) wrote:

> Date: Tue, 22 Nov 2005 16:14:42 +0100 (CET)
> From: "Sylvain Wallez (JIRA)" <jira@apache.org>
> Reply-To: dev@cocoon.apache.org
> To: dev@cocoon.apache.org
> Subject: [jira] Commented: (COCOON-1689) Cannot save a cform containing a
>     multivalued field with more than 9 values !
>
>    [ http://issues.apache.org/jira/browse/COCOON-1689?page=comments#action_12358249 ]
>
> Sylvain Wallez commented on COCOON-1689:
> ----------------------------------------
>
> We have no indication of the JXPath problem that led to avoiding the use of jxpathContext.removePath().
Giacomo, as the author of this change, can you give us more indications on what motivated
it ?

This was a workaround due to a bug in JXPath removePath() method 
reported by Jeremy and me prior to ApacheCon in Stuttgart. At that time 
it was fixed in their repository but not released (and we do not want to 
have unreleased jars in our repository). I'll check whether it works 
with current jxpath jar.

>
>> Cannot save a cform containing a multivalued field with more than 9 values !
>> ----------------------------------------------------------------------------
>>
>>          Key: COCOON-1689
>>          URL: http://issues.apache.org/jira/browse/COCOON-1689
>>      Project: Cocoon
>>         Type: Bug
>>   Components: Blocks: Forms
>>     Versions: 2.1.8, 2.1.9-dev (current SVN), 2.2-dev (Current SVN)
>>     Reporter: Philippe Gassmann
>>     Priority: Minor
>
>>
>> An UnsupportedOperationException occurs when trying to save a form containing a multivalued
field with more that 9 values. Here is the explanation :
>> here is the incriminated code in MultiValueJXPathBinding.java:doSave():
>> Iterator rowPointers = multiValueContext.iteratePointers(this.rowPath);
>>         List l = new ArrayList();
>>         while( rowPointers.hasNext() )
>>         {
>>             Pointer p = (Pointer)rowPointers.next();
>>             l.add(p.asPath());
>>         }
>>         Collections.sort(l);
>>         for( int i = l.size()-1; i >= 0; i-- )
>>         {
>>             multiValueContext.removePath((String)l.get(i));
>>         }
>> This code is wrong :
>> The p.asPath returns something like "/doc/node[x]"
>> if the iterator contains more than 9 values x will be written in TWO characters so,
the result of Collections.sort(l) return for 10 values :
>> /doc/node[10]
>> /doc/node[1]
>> /doc/node[2]
>> /doc/node[3]
>> /doc/node[4]
>> /doc/node[5]
>> /doc/node[6]
>> /doc/node[7]
>> /doc/node[8]
>> /doc/node[9]
>> so the first node to be deleted is 9. the last is 10. but when trying to delete the
10th node it does not exist anymore !
>> A UnsupportedOperationException is thrown.
>
>

- -- 
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDg0PcLNdJvZjjVZARAsQXAKCm7XPfp3RNl61DV9rpUMg39/htSQCfSk2c
ZD+i347W6Rm0F1RvJrn+cJY=
=RRC0
-----END PGP SIGNATURE-----

Mime
View raw message