db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig Russell <Craig.Russ...@Sun.COM>
Subject Re: JDO-58
Date Tue, 31 May 2005 18:20:42 GMT
Hi Michelle,

We should look at the cases for pmf being null. The tearDown method 
relies on the ability to get access to a PM in order to do cleanup. It 
doesn't make sense to go through the expensive process of getting a PMF 
if there is no tearDown work to do.

So perhaps we need to check first for any instances or classes to be 
removed before we get a PMF in tearDown...

And we should probably disallow pmf == null in cases where there is 
work to do.

Craig

On May 31, 2005, at 11:06 AM, Michelle Caisse wrote:

> Alternatively, getPMF() could check to see if pmf is closed or null 
> and return a new pmf  in either case.
>
> -- Michelle
>
> Michael Watzek wrote:
>
>> Hi,
>>
>> there are 5 tests (AfterCloseGetPMThrowsException, 
>> AfterCloseSetMethodsThrowException, Close, 
>> CloseFailsIfTransactionActive, 
>> CloseWithoutPermissionThrowsSecurityException) that call "getPMF()" 
>> and "pmf.close()" in their "testXXX" methods , but they do not 
>> nullify field "pmf". All of those tests fail in "localTearDown": 
>> "localTearDown" calls "getPMF()" which returns field "pmf" if it is 
>> not null. For this reason, "getPMF()" returnes a closed PMF in those 
>> tests.
>>
>> The proposal for a fix is to add a check before "localTearDown" is 
>> called:
>>
>> if (pmf!=null && pmf.isClosed())
>>     pmf = null;
>>
>> Regards,
>> Michael
>
>
>
Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

Mime
View raw message