Details
Description
Some of the methods in the org.jaxen.dom.DocumentNavigator class declare that they will return null if the argument is not of the expected node type but, in fact, they do not check the node type at all. The affected methods are:
getElementNamespaceUri (Object object)
getElementName (Object object)
getElementQName (Object object)
getAttributeNamespaceUri (Object object)
getAttributeName (Object object)
getAttributeQName (Object object)
Additionally, the following methods may throw a ClassCastException for the same reason (they do not check the node type of the argument), and they do not have any javadoc comments to advertise their expected behavior:
getProcessingInstructionTarget(Object obj)
getProcessingInstructionData(Object obj)
We should evaluate the whole idea of returning null when an unexpected node type is received. In general, I think throwing an exception would be a much better option than returning null.