I have the following code that processes a JavaScriptObject that is expected to be a JsArray:
JavaScriptObject jso = ... JsArray jsa = jso.cast(); int cnt = jsa.length(); I am finding that if the JsArray has a single element then jsa.length() results in following exception. All is well if there are 2 or more elements: com.google.gwt.dev.shell.HostedModeException: Expected primitive type int; actual value was undefined at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:51) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:206) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75) at com.google.gwt.core.client.JsArray$.length$(JsArray.java) at com.wellfleetsoftware.gis.gui.gwt.client.editor.PartyEditor.getAttributeAsListGridRecords(PartyEditor.java:108) at com.wellfleetsoftware.gis.gui.gwt.client.editor.PartyEditor.fetchRelatedData(PartyEditor.java:93) at com.wellfleetsoftware.gis.gui.gwt.client.editor.RegistryObjectEditor$1.execute(RegistryObjectEditor.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.moz.MethodDispatch.invoke(MethodDispatch.java:80) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1428) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2840) at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720) at com.google.gwt.dev.GWTShell.run(GWTShell.java:593) at com.google.gwt.dev.GWTShell.main(GWTShell.java:357) Is this a known issue or am I doing something wrong? An example JSON fragment for the 1 element JsArray is: "Email" : [ { "id" : 245081, "address" : "farr...@work.com", "type" : "OfficeEmail" } ], Thanks for any help on this issue. -- Regards, Farrukh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. 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 -~----------~----~----~----~------~----~------~--~---