You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Philippe Gassmann (JIRA)" <ji...@apache.org> on 2005/11/18 16:28:41 UTC

[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_12357980 ] 

Philippe Gassmann commented on COCOON-1689:
-------------------------------------------

Is there really a bug in JXPath removeAll function ?
I cannot find it in the ASF bugzilla.

> 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.2-dev (Current SVN), 2.1.9-dev (current SVN)
>     Reporter: Philippe Gassmann
>     Priority: Blocker

>
> 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.

-- 
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