Project

Profile

Help

Bug #6400

closed

XdmItem.getStringValue() throws undocumented exception

Added by Michael Kay 14 days ago. Updated 11 days ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
s9api API
Sprint/Milestone:
-
Start date:
2024-04-20
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
Java

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?)

Actions #1

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.

Actions #2

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

Also available in: Atom PDF