On 3/11/08, James Carman <[EMAIL PROTECTED]> wrote: > The change I was suggesting wouldn't break any existing code (unless > someone implemented IRequestCycleSettings). The signature of > RequestCycle.onRuntimeException() wouldn't change: > > > public Page onRuntimeException( Page page, RuntimeException e ) > > { > IRuntimeExceptionHandler handler = findBestExceptionHandler(e.getClass()); > if(handler != null) > { > return handler.onRuntimeException(this, e); > } > return null; > } > > protected IRuntimeExceptionHandler findBestExceptionHandler(Class > exceptionClass) > { > while(exceptionClass != null && !exceptionClass.equals(Exception.class)) > { > IRuntimeExceptionHandler handler = > > getApplication().getRequestCycleSettings().getRuntimeExceptionHandler(exceptionClass); > if(handler != null) > { > return handler; > } > exceptionClass = exceptionClass.getSuperclass(); > } > return null; > } > > This way, if the user wants to override the search algorithm, they can > override the findBestExceptionHandler() method. And, if they haven't > registered any handlers, then this method does exactly what it used to > do (nothing). Whatever the default algorithm would be of course is up > for debate. This is just simple example (and off the top of my head, > so if it really doesn't work as is, then sorry). > >
By the way, I can create a patch for this stuff if you like. I guess the decision needs to be made about where the "registry" (Map<Class,IRuntimeExceptionHandler) needs to go. Does it belong in IRequestCycleSettings or IExceptionSettings? And, do you want me to apply it to my already existing code which splits up Settings into multiple default implementations (which you guys said we should hold off on for 1.4.x)? Perhaps there could be logic in there that checks to see if the requested Page object which caused the RuntimeException implements IRuntimeExceptionHandler also. That way, an individual page could override the "global" behavior if they wish. Just a thought. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]