Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317520

Summary: NullPointerException from Hashtable when persisting entity with HashMap
Product: z_Archived Reporter: Tommy Odom <odom>
Component: EclipselinkAssignee: Project Inbox <eclipselink.foundation-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P2 CC: christopher.delahunt, gordon.yorke, michael.f.obrien
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
NPE Stack Trace
none
Entity class causing the NPE
none
Sample code that in my environment produces the error
none
Patch to prevent NPE based on 2.0.2 tag none

Description Tommy Odom CLA 2010-06-21 17:27:49 EDT
Build Identifier: 

When persisting & flushing an entity that contains a Map<String, String> I get a NPE out of Hashtable.  As far as I can tell the NPE only occurs if I explicitly call flush and does not appear to be something that I can reproduce with in the junit tests provided with EclipseLink.  The provided patch does solve the issue but may not be the best approach to the fix, it may be better to ensure that DirectMapContainerPolicy.next(Iterator) returns an instance of Associate instead of Map.Entry as is currently happening in my scenario.  

I've also attached the source entity and some sample code that illustrates what is occurring around the time that the NPE happens.  

I am using static weaving on my types but I don't think that matters in this case but figured I'd mention it just in case.

Reproducible: Always
Comment 1 Tommy Odom CLA 2010-06-21 17:28:21 EDT
Created attachment 172372 [details]
NPE Stack Trace
Comment 2 Tommy Odom CLA 2010-06-21 17:28:47 EDT
Created attachment 172373 [details]
Entity class causing the NPE
Comment 3 Tommy Odom CLA 2010-06-21 17:29:49 EDT
Created attachment 172374 [details]
Sample code that in my environment produces the error

This sample code uses some other types not provided.
Comment 4 Tommy Odom CLA 2010-06-21 17:30:30 EDT
Created attachment 172375 [details]
Patch to prevent NPE based on 2.0.2 tag
Comment 5 Chris Delahunt CLA 2010-07-26 11:09:21 EDT
This seems to have been fixed with refactoring for 211700 in 2.1.  The DirectMapContainerPolicy class no longer exists, so the patch is only valid for 2.0.2

*** This bug has been marked as a duplicate of bug 211700 ***
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:06:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink