|
From: Benoit X. (JIRA) <no...@sp...> - 2008-04-07 15:56:07
|
[ http://jira.springframework.org/browse/RCP-552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benoit Xhenseval updated RCP-552:
---------------------------------
Attachment: AbstractDialogExceptionHandler.java.patch
the afterPropertiesSet calls a method that checks that ApplicationServicesLocator.services() != null before calling it.
Whenever the messageSourceAccessor is required, it will check if it has managed to get it first.
This patch does not modify the interfaces and is transparent in the current usage, it also works for me!
Thanks for considering it
Benoit
> NPE in MessagesDialogExceptionHandler
> -------------------------------------
>
> Key: RCP-552
> URL: http://jira.springframework.org/browse/RCP-552
> Project: Spring Framework Rich Client Project
> Issue Type: Bug
> Components: Dialog System
> Affects Versions: 1.0.0
> Environment: JDK5, WinXP
> Reporter: Benoit Xhenseval
> Attachments: AbstractDialogExceptionHandler.java.patch
>
>
> Hi
> I still get an NPE whenever I use MessagesDialogExceptionHandler.
> For some reason, may be due to my xml configuration (??), the method afterPropertiesSet is called before ApplicationServicesLocator.services() is fully setup:
> Caused by: java.lang.NullPointerException
> at org.springframework.richclient.exceptionhandling.AbstractDialogExceptionHandler.afterPropertiesSet(AbstractDialogExceptionHandler.java:51)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1390)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1359)
> I am using the sample configuration:
> <bean id="exceptionHandler" class="org.springframework.richclient.exceptionhandling.delegation.DelegatingExceptionHandler">
> <property name="delegateList">
> <list>
> <bean class="org.springframework.richclient.exceptionhandling.delegation.SimpleExceptionHandlerDelegate">
> <property name="throwableClassList">
> <list>
> <value type="java.lang.Class">org.acegisecurity.AuthenticationException</value>
> <value type="java.lang.Class">org.acegisecurity.AccessDeniedException</value>
> </list>
> </property>
> <property name="exceptionHandler">
> <bean class="org.springframework.richclient.exceptionhandling.MessagesDialogExceptionHandler">
> <property name="logLevel" value="WARN" />
> <property name="shutdownPolicy" value="NONE" />
> </bean>
> </property>
> </bean>
> <bean class="org.springframework.richclient.exceptionhandling.delegation.SimpleExceptionHandlerDelegate">
> <property name="throwableClass" value="java.lang.Error" />
> <property name="exceptionHandler">
> <bean class="net.objectlab.safemargin.gui.SafeMarginExceptionHandler">
> <property name="logLevel" value="FATAL" />
> <property name="shutdownPolicy" value="OBLIGATE" />
> <property name="issueReporter" ref="issueReporter" />
> </bean>
> </property>
> </bean>
> <!-- The order is important: if Throwable would be first then the others would be ignored -->
> <bean class="org.springframework.richclient.exceptionhandling.delegation.SimpleExceptionHandlerDelegate">
> <property name="throwableClass" value="java.lang.Throwable" />
> <property name="exceptionHandler">
> <bean class="net.objectlab.safemargin.gui.SafeMarginExceptionHandler">
> <property name="logLevel" value="ERROR" />
> <property name="shutdownPolicy" value="ASK" />
> <property name="issueReporter" ref="issueReporter" />
> </bean>
> </property>
> </bean>
> </list>
> </property>
> </bean>
> Any suggestion why this happens immediately at startup?
> <bean id="safemarginLifecycleAdvisor" class="net.objectlab.safemargin.gui.SafeMarginLifecycleAdvisor">
> ....
> <property name="registerableExceptionHandler" ref="exceptionHandler" />
> </bean>
> I will suggest a workaround and a patch that delays the access to ApplicationServicesLocator.services().
> Thanks
> Benoit.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springframework.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|