Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » NullPointerException from Hashtable via IndirectMap
NullPointerException from Hashtable via IndirectMap [message #540633] Wed, 16 June 2010 18:45 Go to next message
Tommy Odom is currently offline Tommy OdomFriend
Messages: 10
Registered: July 2009
Junior Member
Hi,

I'm getting a NullPointerException from java.lang.Hashtable because the DirectMapContainerPolicy is calling put on an IndirectMap which uses a Hashtable under the covers with a null key. Looking back in the stack is appears that on line 128 of org.eclipse.persistence.internal.queries.ContainerPolicy is always passes a null for the key field.

Any ideas?
Re: NullPointerException from Hashtable via IndirectMap [message #540824 is a reply to message #540633] Thu, 17 June 2010 12:58 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
Its hard to say without the stack trace, the conditions the error occurs under and the version of EclipseLink being used. Have you tried the latest from the nightly builds? This will elimitate known fixed bugs as potential causes.

Best Regards,
Chris
Re: NullPointerException from Hashtable via IndirectMap [message #541217 is a reply to message #540633] Fri, 18 June 2010 18:00 Go to previous messageGo to next message
Tommy Odom is currently offline Tommy OdomFriend
Messages: 10
Registered: July 2009
Junior Member
I've included the stack trace below. I am running Eclipselink 2.0.1 and I've looked at the nightly source code for 2.0.3, 2.1.0, and 2.2.0 and I didn't see anything that would obviously resolve the NPE. In all of them ContainerPolicy.java in the addInto method passes null for a key which is eventually going to get passed into the put method of the IndirectMap causing the NPE in the Hashtable.

Now I know that Eclipselink 2.0.1 largely works for me and this is the first time I've hit this. I ran the debugger and most of the calls into that ContainerPolicy.addInto happen on vector containers, list containers, or set containers. However, it's this one case where it's getting called when it's a map that it will always throw a NPE because null can't be used as a key on a Hashtable.

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:399)
at org.eclipse.persistence.indirection.IndirectMap.put(Indirect Map.java:530)
at org.eclipse.persistence.internal.queries.DirectMapContainerP olicy.addInto(DirectMapContainerPolicy.java:106)
at org.eclipse.persistence.internal.queries.ContainerPolicy.add Into(ContainerPolicy.java:128)
at org.eclipse.persistence.internal.queries.DirectMapContainerP olicy.addInto(DirectMapContainerPolicy.java:131)
at org.eclipse.persistence.mappings.CollectionMapping.setChange Listener(CollectionMapping.java:1925)
at org.eclipse.persistence.descriptors.changetracking.ObjectCha ngeTrackingPolicy.clearChanges(ObjectChangeTrackingPolicy.ja va:147)
at org.eclipse.persistence.descriptors.changetracking.Attribute ChangeTrackingPolicy.revertChanges(AttributeChangeTrackingPo licy.java:117)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.res umeUnitOfWork(UnitOfWorkImpl.java:5183)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUni tOfWork.writeChanges(RepeatableWriteUnitOfWork.java:377)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush (EntityManagerImpl.java:696)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$Ext endedEntityManagerInvocationHandler.invoke(ExtendedEntityMan agerCreator.java:358)
at $Proxy38.flush(Unknown Source)
at sun.reflect.GeneratedMethodAccessor93.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.SharedEntityManagerCreator$Share dEntityManagerInvocationHandler.invoke(SharedEntityManagerCr eator.java:198)
at $Proxy38.flush(Unknown Source)
Re: NullPointerException from Hashtable via IndirectMap [message #541637 is a reply to message #541217] Mon, 21 June 2010 21:32 Go to previous messageGo to next message
Tommy Odom is currently offline Tommy OdomFriend
Messages: 10
Registered: July 2009
Junior Member
Just in case anyone comes across this and is interested in the resolution, I filed a bug against EclipseLink, https://bugs.eclipse.org/bugs/show_bug.cgi?id=317520, with a proposed patch to fix the exception.
Re: NullPointerException from Hashtable via IndirectMap [message #541828 is a reply to message #541217] Tue, 22 June 2010 16:22 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
Hello,

In between 2.0.2 and main, the DirectMapContainerPolicy class was removed so the patch is not applicable in future versions. Can you test with the latest and provide the stack trace if it is still an issue?

Regards,
Chris
Previous Topic:native id generator
Next Topic:EclipseLink, JTA, GlassFish Embedded - No transaction is currently active exception
Goto Forum:
  


Current Time: Sat Dec 20 11:41:21 GMT 2014

Powered by FUDForum. Page generated in 0.01667 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software