cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r752132 - in /cxf/trunk/rt/core/src: main/java/org/apache/cxf/bus/spring/ test/java/org/apache/cxf/bus/spring/
Date Tue, 10 Mar 2009 15:06:42 GMT
Author: sergeyb
Date: Tue Mar 10 15:06:37 2009
New Revision: 752132

URL: http://svn.apache.org/viewvc?rev=752132&view=rev
Log:
CXF-2075 : applying a patch on behalf of Seumas - thanks

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Messages.properties
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
    cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java?rev=752132&r1=752131&r2=752132&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContext.java Tue
Mar 10 15:06:37 2009
@@ -32,6 +32,7 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.SystemUtils;
 import org.apache.cxf.configuration.Configurer;
@@ -42,6 +43,7 @@
 import org.springframework.beans.factory.xml.ResourceEntityResolver;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextException;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.FileSystemResource;
@@ -144,7 +146,9 @@
                 resources.add(cpr);
             } else {
                 if (!usingDefault) {
-                    LogUtils.log(LOG, Level.WARNING, "USER_CFG_FILE_NOT_FOUND_MSG", cfgFile);
+                    LogUtils.log(LOG, Level.WARNING, "USER_CFG_FILE_NOT_LOADED", cfgFile);
+                    String message = (new Message("USER_CFG_FILE_NOT_LOADED", LOG, cfgFile)).toString();
+                    throw new ApplicationContextException(message);
                 } else {
                     LogUtils.log(LOG, Level.INFO, "USER_CFG_FILE_NOT_SPECIFIED_MSG", cfgFile);
                 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Messages.properties?rev=752132&r1=752131&r2=752132&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Messages.properties (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/Messages.properties Tue Mar
10 15:06:37 2009
@@ -23,3 +23,5 @@
 USER_CFG_FILE_URL_ERROR_MSG = The configuration file URL {0} is a a malformed URL.
 USER_CFG_FILE_URL_NOT_FOUND_MSG = Could not find the configuration file in the url of {0}.
 APP_CONTEXT_CREATION_FAILED_MSG = Failed to create application context.
+INITIAL_APP_CONTEXT_CREATION_FAILED_MSG = Initial attempt to crate application context was
unsuccessful.
+USER_CFG_FILE_NOT_LOADED=Failed to load configuration {0}

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java?rev=752132&r1=752131&r2=752132&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java Tue Mar
10 15:06:37 2009
@@ -101,6 +101,7 @@
         try {      
             return new BusApplicationContext(cfgFiles, includeDefaults, context);
         } catch (BeansException ex) {
+            LogUtils.log(LOG, Level.WARNING, "INITIAL_APP_CONTEXT_CREATION_FAILED_MSG", ex,
(Object[])null);
             ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
             if (contextLoader != BusApplicationContext.class.getClassLoader()) {
                 Thread.currentThread().setContextClassLoader(

Modified: cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java?rev=752132&r1=752131&r2=752132&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java
(original)
+++ cxf/trunk/rt/core/src/test/java/org/apache/cxf/bus/spring/BusApplicationContextTest.java
Tue Mar 10 15:06:37 2009
@@ -22,17 +22,24 @@
 import org.junit.Assert;
 import org.junit.Test;
 
+import org.springframework.beans.BeansException;
+
 public class BusApplicationContextTest extends Assert {
        
     @Test
     public void testGetResources() {
-        BusApplicationContext ctx = new BusApplicationContext("nowhere.xml", false);
-        assertNull("Unexpected number of resources", ctx.getConfigResources());
+        BusApplicationContext ctx = null;
+
+        try { 
+            ctx = new BusApplicationContext("nowhere.xml", false);
+            fail("Bus creation should have thrown exception.");
+        } catch (BeansException bex) {
+            //Expected
+        }
+
         String cfgFile = "/org/apache/cxf/bus/spring/resources/bus-overwrite.xml";
         ctx = new BusApplicationContext(cfgFile, false);
         assertEquals("Unexpected number of resources", 1, ctx.getConfigResources().length);
-        ctx = new BusApplicationContext("nowhere.xml", true);
-        assertEquals("Unexpected number of resources", 1, ctx.getConfigResources().length);
         ctx = new BusApplicationContext(cfgFile, true);
         assertEquals("Unexpected number of resources", 2, ctx.getConfigResources().length);
     }



Mime
View raw message