Bug #6400
closedXdmItem.getStringValue() throws undocumented exception
0%
Description
The s9api methods XdmItem.getStringValue()
and XdmItem.getUnicodeStringValue()
throw the internal unchecked exception UncheckedXPathException
if applied to an item (such as a map) that has no string value. The exception thrown should be a checked exception and should be documented in the Javadoc.
(Hmmm: adding a checked exception to an existing method may mean existing application code no longer compiles. Perhaps we should only do this at a major release?)
Updated by Michael Kay 13 days ago
I think the most appropriate thing here is to throw an (unchecked) IllegalStateException
. It's the kind of situation where a checked exception is a nuisance because the user knows perfectly well that they are calling the method on an item (such as a node or atomic value) that always has a string value.
Updated by Michael Kay 11 days ago
- Status changed from New to Resolved
- Priority changed from Low to Normal
- Applies to branch 12, trunk added
- Fix Committed on Branch 12, trunk added
Please register to edit this issue