[Sax-devel] Exceptions in Attribues(2), AttributesImpl
Brought to you by:
dmegginson
From: Karl W. <ka...@wa...> - 2003-11-15 01:14:52
|
I ran across what appears as inconsistency to me looking at the Attributes(32) specs and the implementation of AttributesImpl. In the Attributes interface, the getValue(), getType(), getURI(), getQName() and getLocalName() methods are all supposed to return a null value when no attribute matching the parameters passed to the functions is found. However, the corresponding setXXX() methods do throw an ArrayIndexOutOfBoundsException. Also, in the Attributes2 interface, all isXXX() methods throw either an ArrayIndexOutOfBoundsException or an IllegalArgumentException. This looks inconsistent to me, although I can understand technically that those methods do not have return types that would allow to pass such error information back, only an object result type allows to pass null (meaning error). IMO, this does not warrant the inconsistency. I also think that calling the getXXX() methods with an incorrect index or non-existing name should be considered an error and throw an exception, especially when the getIndex() methods already provide an exception free way to check if an attribute exists. Is there any good reason I have overlooked why it should be the way it is? Karl |