See http://code.google.com/p/google-web-toolkit/issues/detail?id=5926
I had the issue with RequestFactory proxies but I suppose it applies to all 
autobeans (as on of the culprits was ProxyAutoBean).
I hope it'll make it into the upcoming GWT 2.5 release.

On Thursday, April 12, 2012 1:02:37 AM UTC+2, kjordan wrote:
>
> I'm trying to use the AutoBean encoding so I can pass and parse types over 
> a websocket connection I have.  However, there seem to be some bugs with 
> trying to encode AutoBeans on the server side.
>
> I had a structure like
>
>> public interface Foo {
>> }
>> public interface Bar {
>> }
>> public interface A<T extends Foo> {
>>    T getFoo();
>>    void setFoo(T foo);
>> }
>> public interface B extends A<Bar> {
>>   @Override Bar getFoo();
>>   @Override void setFoo(Bar foo);
>> }
>
>
> but that ended up getting an exception when the setter is called:
>
>> java.lang.NullPointerException
>>         at 
>> com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.traverse(MethodPropertyContext.java:102)
>>         at 
>> com.google.web.bindery.autobean.vm.impl.MethodPropertyContext.accept(MethodPropertyContext.java:75)
>>         at 
>> com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.maybeCreateCoder(AutoBeanCodexImpl.java:353)
>>         at 
>> com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl$PropertyCoderCreator.visitReferenceProperty(AutoBeanCodexImpl.java:341)
>>         at 
>> com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.traverseProperties(ProxyAutoBean.java:324)
>>         at 
>> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.traverse(AbstractAutoBean.java:166)
>>         at 
>> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.accept(AbstractAutoBean.java:101)
>>         at 
>> com.google.web.bindery.autobean.shared.impl.AutoBeanCodexImpl.doCoderFor(AutoBeanCodexImpl.java:521)
>>         at 
>> com.google.web.bindery.autobean.shared.impl.AbstractAutoBean.setProperty(AbstractAutoBean.java:276)
>>         at 
>> com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.setProperty(ProxyAutoBean.java:253)
>>         at 
>> com.google.web.bindery.autobean.vm.impl.BeanMethod$3.invoke(BeanMethod.java:103)
>>         at 
>> com.google.web.bindery.autobean.vm.impl.SimpleBeanHandler.invoke(SimpleBeanHandler.java:43)
>
>
> So I switched it to:
>
>> public interface A {
>>    Foo getFoo();
>> }
>> public interface B extends A {
>>   @Override Bar getFoo();
>>   @Override void setFoo(Bar foo);
>> }
>
>
> but that gets me:
>
>> java.lang.RuntimeException: Could not parse payload
>>         at 
>> com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:73)
>>         at 
>> com.google.web.bindery.autobean.shared.impl.StringQuoter.split(StringQuoter.java:73)
>>         at 
>> com.google.web.bindery.autobean.shared.AutoBeanCodex.encode(AutoBeanCodex.java:84)
>> Caused by: org.json.JSONException: Duplicate key "foo"
>>         at org.json.JSONObject.putOnce(JSONObject.java:1076)
>>         at org.json.JSONObject.<init>(JSONObject.java:205)
>>         at org.json.JSONObject.<init>(JSONObject.java:402)
>>         at 
>> com.google.web.bindery.autobean.vm.impl.JsonSplittable.create(JsonSplittable.java:47)
>>         ... 12 more
>
>
> I'm going to try it with just the super interfaces and no overriding, but 
> I'm not sure the client is going to reconstruct "foo" with the proper type.
>
> I can maybe understand the first one not working since I know 
> RequestFactory and such are always picky about the use of generics also and 
> I've learned to be careful about that.  But the second one seems to just be 
> it not paying attention to the override which seems like a problem that 
> should be fixed.  On the server-side, I'm using AutoBeanFactorySource to 
> create the AutoBeanFactory, which I see is supposedly "experimental".  I'm 
> then using AutoBeanCodex to do the encoding.  Has anyone had success 
> encoding AutoBeans on the server-side?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/dJ9LES1-5F4J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to