Revision: 1496
          http://svn.sourceforge.net/spring-rich-c/?rev=1496&view=rev
Author:   jhoskens
Date:     2006-10-06 02:59:22 -0700 (Fri, 06 Oct 2006)

Log Message:
-----------
fix for RCP-411: Added check for splashScreen, avoiding NPE

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/ApplicationLauncher.java

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/ApplicationLauncher.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/ApplicationLauncher.java
   2006-10-06 09:55:15 UTC (rev 1495)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/richclient/application/ApplicationLauncher.java
   2006-10-06 09:59:22 UTC (rev 1496)
@@ -147,45 +147,50 @@
         final ClassPathXmlApplicationContext applicationContext = new 
ClassPathXmlApplicationContext(contextPaths,
                 false);
 
-        final ProgressMonitor tracker = splashScreen.getProgressMonitor();
-
-        applicationContext.addBeanFactoryPostProcessor(new 
BeanFactoryPostProcessor() {
-            public void postProcessBeanFactory(ConfigurableListableBeanFactory 
beanFactory) throws BeansException {
-                beanFactory.addBeanPostProcessor(new BeanPostProcessor() {
-                    private int max = -1;
-
-                    public Object postProcessBeforeInitialization(Object bean, 
String beanName)
-                            throws BeansException {
-                        if (max == -1) {
-                            max = 0;
-                            ConfigurableListableBeanFactory 
configurableListBeanFactory = applicationContext.getBeanFactory();
-                            String[] beanNames = 
applicationContext.getBeanDefinitionNames();
-                            for (int i = 0; i < beanNames.length; i++) {
-                                // using beanDefinition to check singleton 
property because when accessing through
-                                // context 
(applicationContext.isSingleton(beanName)), bean will be created already,
-                                // possibly bypassing other 
BeanFactoryPostProcessors
-                                if 
(configurableListBeanFactory.getBeanDefinition(beanNames[i]).isSingleton())
-                                    max++;
+        if (splashScreen != null)
+        {
+                
+            final ProgressMonitor tracker = splashScreen.getProgressMonitor();
+    
+            applicationContext.addBeanFactoryPostProcessor(new 
BeanFactoryPostProcessor() {
+                public void 
postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws 
BeansException {
+                    beanFactory.addBeanPostProcessor(new BeanPostProcessor() {
+                        private int max = -1;
+    
+                        public Object postProcessBeforeInitialization(Object 
bean, String beanName)
+                                throws BeansException {
+                            if (max == -1) {
+                                max = 0;
+                                ConfigurableListableBeanFactory 
configurableListBeanFactory = applicationContext.getBeanFactory();
+                                String[] beanNames = 
applicationContext.getBeanDefinitionNames();
+                                for (int i = 0; i < beanNames.length; i++) {
+                                    // using beanDefinition to check singleton 
property because when accessing through
+                                    // context 
(applicationContext.isSingleton(beanName)), bean will be created already,
+                                    // possibly bypassing other 
BeanFactoryPostProcessors
+                                    if 
(configurableListBeanFactory.getBeanDefinition(beanNames[i]).isSingleton())
+                                        max++;
+                                }
+                                tracker.taskStarted("Loading Application 
Context ...", max);
                             }
-                            tracker.taskStarted("Loading Application Context 
...", max);
+    
+                            if 
(applicationContext.containsLocalBean(beanName)) {
+                                tracker.subTaskStarted("Loading " + beanName + 
" ...");
+                                tracker.worked(1);
+                            }
+    
+                            return bean;
                         }
-
-                        if (applicationContext.containsLocalBean(beanName)) {
-                            tracker.subTaskStarted("Loading " + beanName + " 
...");
-                            tracker.worked(1);
+    
+                        public Object postProcessAfterInitialization(Object 
bean, String beanName)
+                                throws BeansException {
+                            return bean;
                         }
+                    });
+                }
+            });
 
-                        return bean;
-                    }
-
-                    public Object postProcessAfterInitialization(Object bean, 
String beanName)
-                            throws BeansException {
-                        return bean;
-                    }
-                });
-            }
-        });
-
+        }
+        
         applicationContext.refresh();
 
         return applicationContext;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
spring-rich-c-cvs mailing list
spring-rich-c-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to