Author: bstansberry(a)jboss.com
Date: 2008-04-04 11:38:20 -0400 (Fri, 04 Apr 2008)
New Revision: 5500
Modified:
core/branches/2.1.X/src/main/java/org/jboss/cache/config/XmlParsingConfigurationRegistry.java
core/branches/2.1.X/src/test/java/org/jboss/cache/manager/CacheManagerTest.java
Log:
[JBCACHE-1318] Don't throw NPE if no configResource provided
Modified:
core/branches/2.1.X/src/main/java/org/jboss/cache/config/XmlParsingConfigurationRegistry.java
===================================================================
---
core/branches/2.1.X/src/main/java/org/jboss/cache/config/XmlParsingConfigurationRegistry.java 2008-04-04
15:13:03 UTC (rev 5499)
+++
core/branches/2.1.X/src/main/java/org/jboss/cache/config/XmlParsingConfigurationRegistry.java 2008-04-04
15:38:20 UTC (rev 5500)
@@ -38,7 +38,8 @@
{
if (!started)
{
- configs.putAll(parser.parseConfigs(configResource));
+ if (configResource != null)
+ configs.putAll(parser.parseConfigs(configResource));
started = true;
}
}
Modified: core/branches/2.1.X/src/test/java/org/jboss/cache/manager/CacheManagerTest.java
===================================================================
---
core/branches/2.1.X/src/test/java/org/jboss/cache/manager/CacheManagerTest.java 2008-04-04
15:13:03 UTC (rev 5499)
+++
core/branches/2.1.X/src/test/java/org/jboss/cache/manager/CacheManagerTest.java 2008-04-04
15:38:20 UTC (rev 5500)
@@ -149,4 +149,15 @@
assertEquals(0, cacheNames.size());
assertEquals(cacheNames, registry.getConfigurationNames());
}
+
+ public void testNullConfigResource() throws Exception
+ {
+ JChannelFactory cf = new JChannelFactory();
+ cf.setMultiplexerConfig("stacks.xml"); // the default stacks in
jgroups.jar
+ String configResource = null;
+ CacheManagerImpl registry = new CacheManagerImpl(configResource, cf);
+ registry.start();
+
+ assertEquals("No configs", 0, registry.getConfigurationNames().size());
+ }
}