You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Dorel bruno <bd...@wanadoo.fr> on 2007/04/25 12:07:57 UTC
NullPointer exception when using ComparableRessourceImpl.getAllPropertiesNames()
Hi all,
I have a question concerning the "ComparableRessourceImpl.java" :
The getAllPropertiesNames() is not protected against a "null"
propertyProvider : I get a java NullPointerException
when I try to use it , but getAllProperties() is well protected (see
code below or joined file)
Amazing isn't it ?
I try to found a work around
Regards
B DOREL
/**
* Returns an Iterator of PropertyName of all properties.
*
* @return an Iterator of PropertyName.
*
* @throws SlideException
*/
public Iterator getAllPropertiesNames() throws SlideException {
Set propertyNamesSet = new HashSet();
Enumeration props = revisionDescriptor.enumerateProperties();
NodeProperty property = null;
if (props != null) {
while (props.hasMoreElements()) {
property = (NodeProperty)props.nextElement();
propertyNamesSet.add(property.getPropertyName());
}
}
Iterator iterator =
propertyProvider.getSupportedPropertiesNames(getUri());
while (iterator.hasNext()) {
propertyNamesSet.add(iterator.next());
}
return propertyNamesSet.iterator();
}
/**
* Returns all properties as an Iterator of NodeProperty objects.
*
* @return all properties as an Iterator of NodeProperty objects.
*
* @throws SlideException
*/
public Iterator getAllProperties() throws SlideException {
Set propertySet = new HashSet();
Enumeration props = revisionDescriptor.enumerateProperties();
if (props != null) {
while (props.hasMoreElements()) {
propertySet.add(props.nextElement());
}
}
if (propertyProvider != null) {
Iterator iterator =
propertyProvider.getSupportedProperties(getUri());
while (iterator.hasNext()) {
propertySet.add(iterator.next());
}
}
return propertySet.iterator();
}