Friday, February 6, 2015

Re: Autobean deserialize failing ( Ljava_util_List_2_classLit_0_g$ is not defined )

Hi,
just tested your code and actually seems to work using gwt/trunk so maybe it has something to do with the version you are using or the 'response' text.


My EntryPoint:
---

RequestBeanFactory factory = GWT.create(RequestBeanFactory.class);

AutoBean<MyBean> ab = AutoBeanCodex.decode(factory, MyBean.class, "{\"value\":\"ciao\"}");

GWT.log("Decode 1");

MyBean result = ab.as();

GWT.log("Decode 2: " + result.toString());

GWT.log("Result: " + result.getValue());

---


Browser console:
 Decode 1
SuperDevModeLogger.java:71 Decode 2: com..._MyBeanAutoBean$2@1
SuperDevModeLogger.java:71 Result: ciao

-----


Cheers,
   A. 

On Fri Feb 06 2015 at 2:32:42 PM Ali Akhtar <ali.rac200@gmail.com> wrote:
Seems like this error only occurs when I try to access a property of the deserialized bean. I changed my code to the following:

Console.debug("Response-- " + response.getText());




AutoBean<MyBean> ab = AutoBeanCodex.decode(factory, MyBean.class, response.getText());
Console.debug("Decode 1");


InitResult result = ab.as();
Console.debug("Decode 2: " + result.toString());


Console.debug("Result: " + result.getValue());




I now get the output:

Response-- {"value":"tesst"}
Decode 1
Decode 2: com.myModule.MyBeanAutoBean$2@1

com.google.gwt.core.client.JavaScriptException: (ReferenceError) : Ljava_util_List_2_classLit_0_g$ is not defined
Unknown.endVisitType_1_g$(MyModule-0.js@7:63876)
Unknown.traverse_1_g$(MyModule-0.js@18:61737)
Unknown.accept_5_g$(MyModule-0.js@8:61687)
Unknown.maybeCreateCoder_0_g$(MyModule-0.js@12:64201)
Unknown.visitValueProperty_3_g$(MyModule-0.js@8:64216)
Unknown.traverseProperties_0_g$(MyModule-0.js@20:4376)
Unknown.traverse_0_g$(MyModule-0.js@10:4303)
Unknown.accept_4_g$(MyModule-0.js@8:4168)
Unknown.doCoderFor_0_g$(MyModule-0.js@17:63727)
Unknown.getOrReify_0_g$(MyModule-0.js@16:4217)




Bean definition:

public interface MyBean extends Serializable
{
   
public String getValue();
   
public void setValue(String value);
}


public interface RequestBeanFactory extends AutoBeanFactory
{
   
public AutoBean<MyBean> myBean();
}



Any ideas?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment