The following code in the org.jboss.errai.enterprise.client.jaxrs.JacksonTransformer.toJackson() method is throwing a null pointer error because obj.get(k) is returning a JSONNumber, which means the isString() method is returning null. Is this a bug, or have I done something wrong?

EDIT: Ignore that last post. It is probably to do with converting a file into a byte array.

However, when sending a simple List<Byte> to the server, I get this on the server end:

Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.List out of VALUE_NUMBER_INT token
at [Source: org.apache.catalina.connector.CoyoteInputStream@a82ea; line: 1, column: 17]
at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:160) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:194) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.CollectionDeserializer.deserialize(CollectionDeserializer.java:103) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.CollectionDeserializer.deserialize(CollectionDeserializer.java:93) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.CollectionDeserializer.deserialize(CollectionDeserializer.java:25) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:149) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.SettableBeanProperty$MethodProperty.deserializeAndSet(SettableBeanProperty.java:237) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:496) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:350) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:1961) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:889) [jackson-mapper-asl-1.6.3.jar:1.6.3]
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:410) [jackson-jaxrs-1.6.3.jar:1.6.3]
at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:105) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.read(GZIPDecodingInterceptor.java:61) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:108) [resteasy-jaxrs-2.2.1.GA.jar:]
at org.jboss.resteasy.core.MessageBodyParameterInjector.inject(MessageBodyParameterInjector.java:168) [resteasy-jaxrs-2.2.1.GA.jar:]
... 50 more

And using a byte[] instead of a List<Byte> results in the following exception on the client side:

java.lang.ClassCastException: com.google.gwt.json.client.JSONNumber cannot be cast to java.lang.String
at com.google.gwt.json.client.JSONNumber.toString(JSONNumber.java)
at java.lang.String.valueOf(String.java:2902)
at java.lang.StringBuffer.append(StringBuffer.java:232)
at com.google.gwt.json.client.JSONArray.toString(JSONArray.java:132)
at java.lang.String.valueOf(String.java:2902)
at java.lang.StringBuffer.append(StringBuffer.java:232)
at com.google.gwt.json.client.JSONObject.toString(JSONObject.java:183)
at org.jboss.errai.enterprise.client.jaxrs.JacksonTransformer.toJackson(JacksonTransformer.java:56)
at org.jboss.errai.enterprise.client.jaxrs.MarshallingWrapper._toJSON(MarshallingWrapper.java:45)
at org.jboss.errai.enterprise.client.jaxrs.MarshallingWrapper.toJSON(MarshallingWrapper.java:32)
at org.jboss.errai.enterprise.client.jaxrs.JaxrsProxyLoaderImpl$1RESTInterfaceV1Impl.createJSONImage(JaxrsProxyLoaderImpl.java:1820)
at com.redhat.topicindex.extras.client.local.App$6.onLoadEnd(App.java:142)
at org.vectomatic.file.events.LoadEndEvent.dispatch(LoadEndEvent.java:53)
at org.vectomatic.file.events.LoadEndEvent.dispatch(LoadEndEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEventFromSource(SimpleEventBus.java:96)
at com.google.gwt.event.shared.SimpleEventBus.fireEventFromSource(SimpleEventBus.java:62)
at com.google.gwt.event.shared.EventBus.castFireEventFromSource(EventBus.java:75)
at com.google.gwt.event.shared.SimpleEventBus.fireEventFromSource(SimpleEventBus.java:67)
at org.vectomatic.file.FileReader.fireEvent(FileReader.java:286)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at org.vectomatic.file.FileReader.dispatch(FileReader.java:281)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:722)

com.google.gwt.dev.shell.HostedModeException: Something other than an int was returned from JSNI method '@com.google.gwt.json.client.JSONArray::size()': JS value of type Java Object com.google.gwt.dev.shell.JsValueOOPHM$DispatchObjectOOPHM, expected int
at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeInt(ModuleSpace.java:247)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeInt(JavaScriptHost.java:75)
at com.google.gwt.json.client.JSONArray.size(JSONArray.java)
at org.jboss.errai.enterprise.client.jaxrs.JacksonTransformer.toJackson(JacksonTransformer.java:104)
at org.jboss.errai.enterprise.client.jaxrs.JacksonTransformer.toJackson(JacksonTransformer.java:137)
at org.jboss.errai.enterprise.client.jaxrs.JacksonTransformer.toJackson(JacksonTransformer.java:54)
at org.jboss.errai.enterprise.client.jaxrs.MarshallingWrapper._toJSON(MarshallingWrapper.java:45)
at org.jboss.errai.enterprise.client.jaxrs.MarshallingWrapper.toJSON(MarshallingWrapper.java:32)
at org.jboss.errai.enterprise.client.jaxrs.JaxrsProxyLoaderImpl$1RESTInterfaceV1Impl.createWithByteArray(JaxrsProxyLoaderImpl.java:73)
at com.redhat.topicindex.extras.client.local.App$1.onClick(App.java:72)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Thread.java:722)

However, this appears to be a string limit or something similar. I am trying to populate the byte[] from the contents of a file (loaded using lib-gwt-file). When the byte[] is only a few elements long, the REST object is serialized and set off fine. I guess I'll have to abandon the client side only approach, and upload the file to a server side component which can then call the REST server.

Is there some practical limit to how much data Errai can serialize as JSON?