Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317520 - NullPointerException from Hashtable when persisting entity with HashMap
Summary: NullPointerException from Hashtable when persisting entity with HashMap
Status: RESOLVED DUPLICATE of bug 211700
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-21 17:27 EDT by Tommy Odom CLA
Modified: 2022-06-09 10:06 EDT (History)
3 users (show)

See Also:


Attachments
NPE Stack Trace (1.87 KB, text/plain)
2010-06-21 17:28 EDT, Tommy Odom CLA
no flags Details
Entity class causing the NPE (2.27 KB, application/octet-stream)
2010-06-21 17:28 EDT, Tommy Odom CLA
no flags Details
Sample code that in my environment produces the error (1.50 KB, application/octet-stream)
2010-06-21 17:29 EDT, Tommy Odom CLA
no flags Details
Patch to prevent NPE based on 2.0.2 tag (910 bytes, application/octet-stream)
2010-06-21 17:30 EDT, Tommy Odom CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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