Am 21.03.2010 17:16, schrieb Martin Buchholz:
On Sun, Mar 21, 2010 at 05:00, Ulf Zibis<[email protected]>  wrote:

On Sat, Mar 20, 2010 at 14:52, Ulf Zibis<[email protected]>    wrote:


- A little "bug" in javadoc:
  @exception ArrayIndexOutOfBoundsException
  instead    IndexOutOfBoundsException


Not a bug.


Yes, but decreases the users capabilities catching exceptions more precise
and flexible.

There is a debate about whether to reuse existing exception classes
or to throw class-specific subclasses.  IMO, IOOBE is a sufficiently expressive
exception that I might have used just that, with expressive detail messages.


I'm with you. Especially StringIndexOutOfBoundsException appears as superfluous sugar to me. But we have it in the docs, so there is no way to get rid of it. What do you think about to refactor most IOOBEs in String related classes to SIOOBEs? It would stay compatible to old Software, which still catches IOOBEs, but would look more straight, tidy and clean and fix the below mentioned bug.

-Ulf


But that's only a consideration when designing new API or a new platform.
Old API must stay unchanged, for compatibility.


Imagine, a method would throw an IndexOutOfBoundsException for some reason
and too calls Character.toChars(). The caller of such a method could
distinguish, where the exception would come from, and have separate catch
blocks. But if not documented ... :-(

In extreme, following too would not be a bug in your sense:
  @exception Exception

I became sensitive on this, as I have seen real bugs in
AbstractStringBuilder vice versa, where methods actually throw
IndexOutOfBoundsExceptions, but their javadoc states StringIndexOutOf
BoundsException.

Now that's a real bug.

Martin




Reply via email to