powered by Jive Software

Javadoc correction XMLProperties.java

In org.jivesoftware.util.XMLProperties.java

This javadoc is clearly wrong

/**
* Return all values who’s path matches the given property
* name as a String array, or an empty array if the if there
* are no children. This allows you to retrieve several values
* with the same property name. For example, consider the
* XML file entry:
*


* <foo>
* <bar>
* <prop>some value</prop>
* <prop>other value</prop>
* <prop>last value</prop>
* </bar>
* </foo>
*

* If you call getProperties(“foo.bar.prop”) will return a string array containing
* {“some value”, “other value”, “last value”}.
*
* @param name the name of the property to retrieve
* @return all child property values for the given node name.
*/
public Iterator getChildProperties(String name) {
String[] propName = parsePropertyName(name);
// Search for this property by traversing down the XML heirarchy,
// stopping one short.
Element element = document.getRootElement();
for (int i = 0; i < propName.length - 1; i++) {
element = element.element(propName[i]);
if (element == null) {
// This node doesn’t match this part of the property name which
// indicates this property doesn’t exist so return empty array.
return Collections.EMPTY_LIST.iterator();
}
}
// We found matching property, return values of the children.
Iterator iter = element.elementIterator(propName[propName.length - 1]);
ArrayList props = new ArrayList();
while (iter.hasNext()) {
props.add(((Element)iter.next()).getText());
}
return props.iterator();
}

I feel that this is more accurate.

/**
* Return all values who’s path matches the given property
* name as a String Iterator. This allows you to retrieve several values
* with the same property name. For example, consider the
* XML file entry:
*


* <foo>
* <bar>
* <prop>some value</prop>
* <prop>other value</prop>
* <prop>last value</prop>
* </bar>
* </foo>
*

* If you call getChildProperties(“foo.bar.prop”) will return a string Iterator containing
* {“some value”, “other value”, “last value”}.
*
* @param name the name of the property to retrieve
* @return all child property values for the given node name.
*/

Is there some more appropriate format I should submit this in in order to have the changes applied to trunk?