I just downloaded the latest OJB code from cvs and this class bears no
resemblance to what I have.  Therefore, we can ignore this problem.


----- Original Message -----
From: "Rajeev Kaul" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Friday, November 22, 2002 12:26 PM
Subject: OJB crash in PersistenceBrokerFactory


I have been using OJB with JBOSS/TOMCAT, and finding that it would crash
every now and then.  I debugged the code to find it was crashing in the
following methods of org.apache.ojb.broker.PersistenceBrokerFactory class:

setCurrentPersistenceBroker()



currentPersistenceBroker()



I found that in both these methods the following statement:



HashMap map = (HashMap) currentBrokerMap.get();



would return a null map object every now and then, and since the code does
not check for the null map object it would crash on those occasions.

I added the following fix:

HashMap map = (HashMap) currentBrokerMap.get();

if (null == map)

{

currentBrokerMap.set(new HashMap());

map = (HashMap) currentBrokerMap.get();

}

if (null != map)

{

....

}



This seems to have solved my problem, but I am not quite sure why the map
object is (occasionally) null when it is being initialized in static
statement of the class.  Any ideas?






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to