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 ...