cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Gallardo <agalla...@agssa.net>
Subject Re: svn commit: r219856 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms: binding/MultiValueJXPathBinding.java flow/javascript/ScriptableWidget.java
Date Wed, 20 Jul 2005 14:37:26 GMT
Hi Giacomo,

I guess it is related to commons-jxpath-1.2. Can you add the buggy 
version number of the JXPath lib? This could help in the future to check 
if this bug is already fixed on the released jars? If there is already a 
bug for this in JXPath, will be fine to add the bug # in the comment.

Best Regards,

Antonio Gallardo

giacomo@apache.org wrote:

>Author: giacomo
>Date: Wed Jul 20 01:19:35 2005
>New Revision: 219856
>
>URL: http://svn.apache.org/viewcvs?rev=219856&view=rev
>Log:
>added workaround for a bug in commons-jxpath's JXPathContext.removeAll(path) which isn't
really removing all elements from a Collection type object
>
>Modified:
>    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
>    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java
>
>Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
>URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java?rev=219856&r1=219855&r2=219856&view=diff
>==============================================================================
>--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
(original)
>+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
Wed Jul 20 01:19:35 2005
>@@ -15,8 +15,11 @@
>  */
> package org.apache.cocoon.forms.binding;
> 
>+import java.util.ArrayList;
>+import java.util.Collections;
> import java.util.Iterator;
> import java.util.LinkedList;
>+import java.util.List;
> import java.util.Locale;
> 
> import org.apache.avalon.framework.logger.Logger;
>@@ -104,7 +107,23 @@
>         JXPathContext multiValueContext = jctx.getRelativeContext(jctx.createPath(this.multiValuePath));
> 
>         // Delete all that is already present
>-        multiValueContext.removeAll(this.rowPath);
>+        
>+        // Unfortunately the following statement doesn't work (it doesn't removes all
elements from the 
>+        // list because of a bug in JXPath) so I had to work out another immediate solution
>+        //multiValueContext.removeAll(this.rowPath);
>+        
>+        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));
>+        }
> 
>         boolean update = false;
> 
>
>Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java
>URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java?rev=219856&r1=219855&r2=219856&view=diff
>==============================================================================
>--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java
(original)
>+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/flow/javascript/ScriptableWidget.java
Wed Jul 20 01:19:35 2005
>@@ -30,6 +30,8 @@
> import org.mozilla.javascript.Undefined;
> import org.mozilla.javascript.Wrapper;
> 
>+import java.util.Collection;
>+
> /**
>  * @version $Id$
>  * 
>@@ -256,6 +258,8 @@
>                     }
>                 } else if (value instanceof Object[]) {
>                     values = (Object[])value;
>+                } else if (value instanceof Collection ) {
>+                    values = ((Collection)value).toArray();
>                 }
>                 field.setValues(values);
>             } else {
>
>  
>


Mime
View raw message