On Sun, Aug 07, 2011 at 10:47:41PM -0700, Phil Steitz wrote: > I was about to do this: > throw MathRuntimeException.createArrayIndexOutOfBoundsException( > LocalizedFormats.OUT_OF_RANGE_SIMPLE, index, 0, > parameters.length); > > but remembered that this is now deprecated. Do I need to add a > MathArrayIndexOutOfBoundsException extending the JDK exception and > then throw that directly?
Do we really want to subclass all Java exceptions? There was a discussion where I thought that we circumscribed all the types of problems that would need CM exceptions to sublcass the standard ones. Cases such as this would fall in the "illegal argument" category. Thus: throw new OutOfRangeException(index, 0, parameters.length); or, to get a more detailed message, OutOfRangeException e = new OutOfRangeException(index, 0, parameters.length); e.addMessage(INDEX, index); throw e; Of course, "OutOfRangeException" cannot inherit from both "IllegalArgumentException" and "IndexOutOfBoundsException"... Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org