Objectify 4 : load command chain on unregistered entity throws NullPointerException

141 views
Skip to first unread message

Salomon BRYS

unread,
May 23, 2012, 4:23:36 AM5/23/12
to objectify...@googlegroups.com
Hi there,
Using Objectify 4, I have written this line of code :

MyModel model = ofy.load().type(MyModel.class).id(42).get();

And simply forgot to register MyModel with ObjectifyService.register(MyModel.class);

Objectify 3 used to throw an exception like "Class MyModel has not been registered" or something like that but Objectify 4 throws a NullPointerException.
I think this is an error as NullPointerException should never been thrown by a library, libraries should throw meaningful exceptions.

Here's the full exception :

java.lang.NullPointerException
at com.googlecode.objectify.impl.CacheControlImpl.getExpirySeconds(CacheControlImpl.java:25)
at com.googlecode.objectify.cache.EntityMemcache.getAll(EntityMemcache.java:207)
at com.googlecode.objectify.cache.CachingAsyncDatastoreService.get(CachingAsyncDatastoreService.java:253)
at com.googlecode.objectify.impl.engine.LoadEngine$Round.execute(LoadEngine.java:131)
at com.googlecode.objectify.impl.engine.LoadEngine.execute(LoadEngine.java:216)
at com.googlecode.objectify.impl.cmd.LoaderImpl.refs(LoaderImpl.java:109)
at com.googlecode.objectify.impl.cmd.LoaderImpl.refs(LoaderImpl.java:97)
at com.googlecode.objectify.impl.cmd.LoaderImpl.ref(LoaderImpl.java:87)
at com.googlecode.objectify.impl.cmd.LoadTypeImpl.refOf(LoadTypeImpl.java:91)
at ...[Line where the load is]
at ...

Jeff Schnitzer

unread,
May 23, 2012, 12:37:22 PM5/23/12
to objectify...@googlegroups.com
This is a bug - it will be fixed soon. Sorry about that.

Jeff

Gro Savant

unread,
Sep 16, 2013, 12:56:15 AM9/16/13
to objectify...@googlegroups.com, je...@infohazard.org
Just checking to see if this bug was fixed (or will be soon)... Just ran into the same error message that has me scratching my head wondering which entity is causing the headache.
Reply all
Reply to author
Forward
0 new messages