Take a look at the Petclinic's exceptionHandling view and it's application context. BadCredentialsException shouldn't be logged as an error (but a warn or info), while OutOfMemoryError should be logged as an error and force an application shutdown. This is now configurable, with the support classes in the tiger module. There is an inferiour default, that works in 1.4.
It's no longer possible to wire in a eventExceptionHandler Class into the lifecycleAdvisor.
<bean id="lifecycleAdvisor" class="org.springframework.richclient.samples.simple.app.SimpleLifecycleAdvisor"> ... <property name="eventExceptionHandler" ... <!-- No longer possible --> </bean>
Instead there is the much finer grained system, by injecting a registerableExceptionHandler. If you are using java 1.5, use at least this:
<bean id="petclinicLifecycleAdvisor" ...> ... <property name="registerableExceptionHandler" ref="exceptionHandler"/> </bean> <bean id="exceptionHandler" class="org.springframework.richclient.exceptionhandling.MessagesDialogExceptionHandler"> <property name="logLevel" value="ERROR"/> <property name="shutdownPolicy" value="NONE"/> </bean>
With this in your messages.properties :
java.lang.RuntimeException.caption = Unexpected general bug java.lang.RuntimeException.description = \ The application experienced an unexpected bug,\n\ due to a programming error.\n\ \n\ The application is possibly in an inconsistent state.\n\ It's recommended to reboot the application.\n\ \n\ The exact bug is:\n\ {0}\n\ \n\ Please report this bug. java.lang.Error.caption = Unexpected serious system failure java.lang.Error.description = \ A serious system failure occured.\n\ \n\ The application is possibly in an inconsistent state.\n\ Reboot the application.\n\ \n\ The exact bug is:\n\ {0}\n\ \n\ Please report this bug.
See Petclinic for an advanced features example using the delegating exception handler, which allows you to analyze the throwable and delegate to a different handler based on it's type etc.
ApplicationLauncher no longer wraps it's runtime exceptions in an ApplicationException and it no longer logs them either before throwing. This is to avoid double logging when both logging and throwing - as the thrown will probably be logged too.
So you might want to try-catch your ApplicationLauncher startup:
try { new ApplicationLauncher(...); } catch (RuntimeException e) { logger.error("RuntimeException during startup", e); }
Or you could initialize an LoggingExceptionHandler on your main thread before using ApplicationLauncher.
LoginCommand no longer handles an authentication exception, but lets the global exception handler handle it.
To get a decent i18n based bad credentials message, you 'll probably want to enable a MessagesDialogExceptionHandler (see petclinic) and configure this in your messages.properties :
org.acegisecurity.BadCredentialsException.caption = Authentication failed org.acegisecurity.BadCredentialsException.description = \ Your username did not match your password.\n\ \n\ Please verify your username and password. org.acegisecurity.AuthenticationException.caption = Authentication failed org.acegisecurity.AuthenticationException.description = \ You are not or no longer allowed to log in.\n\ \n\ Please verify your username.
DefaultApplicationServices now searches for a bean with a name of the decapitalized short name of the requested service type, if no bean was defined through direct injection. ApplicationServicesLocator can be used to lookup custom services as well without injecting them through registryEntries property of DefaultApplicationServices .
If the service type is org.springframework.rules.RulesSource the name to lookup will be rulesSource . If a bean can be found in the current application context and it implements org.springframework.rules.RulesSource it will be used as the implementation for it.
setParent(Window) is replaced by setParentComponent(Component) . This allows to pass any component which has the appropriate Frame/Dialog in it's hierarchy. Window can still be retrieved by getParentWindow() .
setLocationRelativeTo(Component) is added. Before this method, the parent component was always used (if given) to set the location, but this might not be the preferred way. This method provides more flexibility as to where your dialog will be placed besides the setLocation(point) method.
org.springframework.richclient.exceptionhandling.DelegatingExceptionHandler has been moved to org.springframework.richclient.exceptionhandling.delegation.DelegatingExceptionHandler
org.springframework.richclient.exceptionhandling.DelegatingExceptionHandlerDelegate has been moved and renamed to org.springframework.richclient.exceptionhandling.delegation.SimpleExceptionHandlerDelegate
It's now possible to plug in your own ExceptionHandlerDelegate 's and there's a new one which can select based on a exception chain hierarchy ChainInspectingExceptionHandlerDelegate (however a simple ExceptionPurger in SimpleExceptionHandlerDelegate will suffice most likely).
MessagesDialogExceptionHandler no longer has evaluatedChainedIndex, use a DefaultExceptionPurger instead.
<bean id="lifecycleAdvisor" class=... ... <property name="windowCommandManagerBeanName" value="windowCommandManager" /> <property name="menubarBeanName" value="menuBar" /> <property name="toolbarBeanName" value="toolBar" /> </bean>