persistence@glassfish.java.net

Re: Fixing issue #383

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Wed, 15 Mar 2006 13:05:12 -0800

OK. Please approve the fix:

Index:
src/java/oracle/toplink/essentials/internal/annotations/EJBAnnotationsProcessor.java
===================================================================
RCS file:
/cvs/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/annotations/EJBAnnotationsProcessor.java,v
retrieving revision 1.22
diff -r1.22 EJBAnnotationsProcessor.java
27a28
> import java.util.Hashtable;
1347c1348,1351
< m_session.getProject().getAliasDescriptors().remove("");
---
>         Hashtable aliasDescriptors = m_session.getProject().getAliasDescriptors();
>         if (aliasDescriptors != null) {
>             aliasDescriptors.remove("");
>         }
thanks,
-marina
Tom Ware wrote On 03/15/06 06:25,:
> I took another look.  Guy is correct here.  Let's go with option A.
> 
> Appologies,
> Tom
> 
> Guy Pelletier wrote:
> 
> 
>>Actually I was already looking at this. Go ahead and use option A for now. 
>>We will plan to take a look at this again after 100% CTS compliance.
>>
>>Cheers,
>>Guy
>>
>>----- Original Message ----- 
>>From: "Tom Ware" <tom.ware_at_oracle.com>
>>To: <persistence_at_glassfish.dev.java.net>
>>Sent: Wednesday, March 15, 2006 8:43 AM
>>Subject: Re: Fixing issue #383
>>
>>
>> 
>>
>>
>>>That sounds fine to me.
>>>
>>>-Tom
>>>
>>>Craig L Russell wrote:
>>>
>>>   
>>>
>>>
>>>>Hi Marina,
>>>>
>>>>FWIW, I like to use pattern b if it's a one-shot issue (which this  sounds 
>>>>like). There's no downside to creating a hashtable once. If  you are 
>>>>constantly creating it and testing for an empty hashset, it's  easier to 
>>>>have the hashset defined as null and avoid the construction.
>>>>
>>>>Craig
>>>>
>>>>On Mar 14, 2006, at 6:53 PM, Marina Vatkina wrote:
>>>>
>>>>
>>>>     
>>>>
>>>>
>>>>>Tom,
>>>>>
>>>>>The NPE is caused by the following code m_session.getProject 
>>>>>().getAliasDescriptors().remove("");
>>>>>
>>>>>When there are no entities in the PU, the alias descriptors
>>>>>hashtable is null because it's never created.
>>>>>
>>>>>There are 2 options to fix it:
>>>>>a) change the line above to
>>>>>Hashtable d = m_session.getProject().getAliasDescriptors();
>>>>>if (d != null)
>>>>>d.remove("");
>>>>>
>>>>>b) Change the Project class to create aliasDescriptors in the
>>>>>constructor.
>>>>>
>>>>>If you don't see a problem with ether fix, I can make the change.
>>>>>
>>>>>regards,
>>>>>-marina
>>>>>
>>>>>       
>>>>>
>>>>
>>>>Craig Russell
>>>>Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
>>>>408 276-5638 mailto:Craig.Russell_at_sun.com
>>>>P.S. A good JDO? O, Gasp!
>>>>
>>>>
>>>>     
>>>>
>>>
>>>-- 
>>>Tom Ware
>>>Principal Software Engineer
>>>Oracle Canada Inc.
>>>
>>>Direct: (613) 783-4598
>>>Email: tom.ware_at_oracle.com
>>>
>>>   
>>>
> 
>