ivelin 2002/10/05 09:32:00 Modified: src/java/org/apache/cocoon/components/xmlform Form.java Log: fixed bug: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=12986 Revision Changes Path 1.11 +18 -15 xml-cocoon2/src/java/org/apache/cocoon/components/xmlform/Form.java Index: Form.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/xmlform/Form.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Form.java 29 Jul 2002 03:06:37 -0000 1.10 +++ Form.java 5 Oct 2002 16:32:00 -0000 1.11 @@ -69,6 +69,7 @@ import java.util.HashSet; import java.util.TreeSet; import java.util.List; +import java.util.LinkedList; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; @@ -242,7 +243,7 @@ // } // - Pointer pointer = jxcontext_.locateValue( xpath ); + Pointer pointer = jxcontext_.getPointer( xpath ); Object property = pointer.getValue(); // if there are multiple values to set // (like in the selectMany case), @@ -287,14 +288,9 @@ public Object getValue(String xpath) { -// // Dmitri Plotnikov's patch -// if (model_ == null) -// throw new IllegalStateException( "Form model not set" ); -// return jxcontext_.getValue(xpath); - if (model_ == null) throw new IllegalStateException( "Form model not set" ); - Pointer pointer = jxcontext_.locateValue( xpath ); + Pointer pointer = jxcontext_.getPointer( xpath ); Object property = pointer.getValue(); if ( property != null) { @@ -319,16 +315,23 @@ * into a list of concrete node locations * @param xpath the nodeset selector * - * @return a Set of XPath strings pointint to + * @return a Set of XPath strings pointing to * each nodeset satisfying the nodeset selector + * + * @todo the Collection return type should be replaced with a Set. + * LinkedHashSet implementation should be used. All resolved + * nodes are unique in the resulting set, therefore Set is more appropriate. + * Since LinkedHashSet is only available in JDK 1.4 or later, it is not + * appropriate to make the change immediately. + * * */ - public Set locate( String xpathSelector ) + public Collection locate( String xpathSelector ) { if (model_ == null) throw new IllegalStateException( "Form model not set" ); - Set nodeset = new HashSet(); - Iterator iter = jxcontext_.locate( xpathSelector ).iterator (); + List nodeset = new LinkedList(); + Iterator iter = jxcontext_.iteratePointers( xpathSelector ); while ( iter.hasNext() ) { Pointer nextPointer = (Pointer) iter.next();
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]