Hi,
after updating from SmartGWT 2.2 to 2.4, I've realized a problem with getting attribute values of primitive Java types by method:
For common types like String it works ok. And also the problem appears only in Debug mode (tested in browser IE9).
For ex. when try to get value of Boolean attribute by this method, there is an exception thrown:
Here is a simple example of code, which reproduces the problem (One form item with aditional boolean attribute. After changing the value, there will be an exception thrown).
I know that .getAttributeAsBoolean() method could be used in this case, but this is not an option in our application implementation.
I just wanted to ask, if there is some change in handling of this primitive Java types, or if it is some kind of bug?
Thanks for any hints.
after updating from SmartGWT 2.2 to 2.4, I've realized a problem with getting attribute values of primitive Java types by method:
Code:
RefDataClass.getAttributeAsObject()
For ex. when try to get value of Boolean attribute by this method, there is an exception thrown:
Code:
java.lang.IllegalArgumentException: Something other than a Java object was returned from JSNI method '@com.smartgwt.client.util.JSOHelper::getAttributeAsObject(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;)': JS value of type boolean, expected java.lang.Object at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:178) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:271) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) at com.smartgwt.client.util.JSOHelper.getAttributeAsObject(JSOHelper.java) at com.smartgwt.client.core.DataClass.getAttributeAsObject(DataClass.java:207) at de.usu.s3.web.client.VMClient$1.onChanged(VMClient.java:48) at com.smartgwt.client.widgets.form.fields.events.ChangedEvent.dispatch(ChangedEvent.java:97) at com.smartgwt.client.widgets.form.fields.events.ChangedEvent.dispatch(ChangedEvent.java:1) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.fireEvent(HandlerManager.java:65) at com.google.gwt.event.shared.HandlerManager$HandlerRegistry.access$1(HandlerManager.java:53) at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:178) at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:237) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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:157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:129) 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:214) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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:157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Unknown Source)
Code:
FormItem item = new CheckboxItem("test", "Testing Checkbox"); item.setAttribute("testBoolAttr", Boolean.TRUE); item.addChangedHandler(new ChangedHandler() { public void onChanged(ChangedEvent event) { Object tmpObject = event.getItem().getAttributeAsObject("testBoolAttr"); SC.say("testBoolAttr: " + tmpObject.toString()); } }); DynamicForm tmpForm = new DynamicForm(); tmpForm.setFields(item); tmpForm.show();
I just wanted to ask, if there is some change in handling of this primitive Java types, or if it is some kind of bug?
Thanks for any hints.
Comment