[jboss-cvs] JBossAS SVN: r68168 - trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 11 19:47:07 EST 2007
Author: bstansberry at jboss.com
Date: 2007-12-11 19:47:07 -0500 (Tue, 11 Dec 2007)
New Revision: 68168
Modified:
trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
Log:
Avoid NPEs if cleanup() is called when state isn't ready
Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2007-12-12 00:45:05 UTC (rev 68167)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/clusteredentity/EntityTestBean.java 2007-12-12 00:47:07 UTC (rev 68168)
@@ -100,19 +100,19 @@
listener.clear();
Customer customer = new Customer();
- customer.setId(1);
+ customer.setId(new Integer(1));
customer.setName("JBoss");
Set<Contact> contacts = new HashSet<Contact>();
Contact kabir = new Contact();
- kabir.setId(1);
+ kabir.setId(new Integer(1));
kabir.setCustomer(customer);
kabir.setName("Kabir");
kabir.setTlf("1111");
contacts.add(kabir);
Contact bill = new Contact();
- bill.setId(2);
+ bill.setId(new Integer(2));
bill.setCustomer(customer);
bill.setName("Bill");
bill.setTlf("2222");
@@ -191,7 +191,9 @@
{
if (listener != null)
{
- getCache().removeCacheListener(listener);
+ Cache c = getCache();
+ if (c != null)
+ c.removeCacheListener(listener);
}
}
catch (Exception e)
@@ -203,7 +205,7 @@
{
if (manager != null)
{
- Customer c = findByCustomerId(1);
+ Customer c = findByCustomerId(new Integer(1));
if (c != null)
{
Set contacts = c.getContacts();
@@ -222,7 +224,7 @@
private Cache getCache() throws Exception
{
- if (cache == null)
+ if (cache == null && cacheObjectName != null)
{
MBeanServer server = MBeanServerLocator.locateJBoss();
CacheJmxWrapperMBean proxy = (CacheJmxWrapperMBean)MBeanProxyExt.create(CacheJmxWrapperMBean.class, new ObjectName(cacheObjectName), server);
More information about the jboss-cvs-commits
mailing list