google-code-export / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
1 stars 0 forks source link

Cannot put List proxy in memcache > java.lang.IllegalArgumentException: Cannot use as value #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to add the results of:

ofyService.ofy().load().type(Customer.class).list();

in the memcache, but it gives me the following error:

[INFO] java.lang.IllegalArgumentException: Cannot use as value: '[]'
[INFO]  at 
com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.serializeValue(AsyncM
emcacheServiceImpl.java:278)
~[appengine-api-1.0-sdk-1.8.1.jar:na]
[INFO]  at 
com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.doPut(AsyncMemcacheSe
rviceImpl.java:413) ~[appengine-api-1.0-sdk-1.8.1.jar:na]
[INFO]  at 
com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.put(AsyncMemcacheServ
iceImpl.java:476) ~[appengine-api-1.0-sdk-1.8.1.jar:na]
[INFO]  at 
com.google.appengine.api.memcache.MemcacheServiceImpl.put(MemcacheServiceImpl.ja
va:79) ~[appengine-api-1.0-sdk-1.8.1.jar:na]

Note that the list was indeed empty.

As discussed 
https://groups.google.com/forum/#!topic/objectify-appengine/v_4wLnOWtME this 
should be possible without wrapping the List proxy in e.g. a ArrayList.

Original issue reported on code.google.com by marceloverdijk on 25 Jun 2013 at 8:33

GoogleCodeExporter commented 9 years ago
Note I'm using Objectify 4.0rc1

Original comment by marceloverdijk on 25 Jun 2013 at 8:38

GoogleCodeExporter commented 9 years ago
Just for the record: issue also occurs in 4.0 (final)

Original comment by marceloverdijk on 3 Apr 2014 at 9:02

GoogleCodeExporter commented 9 years ago
This should work with 4.1 and later. Objectify now provides writeReplace() 
logic to make all of the result values serializable.

Original comment by lhori...@gmail.com on 14 Apr 2014 at 1:06