Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    IllegalArgumentException at JSOHelper.convertToMap

    The following worked in the 'Version v8.3p_2013-01-21/PowerEdition Deployment (2013-01-21)' build:

    Code:
    public void onModuleLoad() {
    	DataSource ds = DataSource.get("Orders");
    	ds.fetchData(new Criteria("STATUS", "Shipped"), new DSCallback() {
    		@Override
    		public void execute(DSResponse response, Object rawData, DSRequest request) {
    			RecordList list = response.getDataAsRecordList();
    	
    			Record foo = new Record();
    			foo.setAttribute("COMMENTS", "foo");
    			list.add(foo);
    			
    			for (int i=0; i < list.getLength(); i++) {
    				Record record = list.get(i);
    				//boom
    				Map m = record.toMap();
    				GWT.log(String.valueOf(m.get("COMMENTS")));
    			}
    		}
    	});
    }
    But got broken in the 2013-01-22 build:

    Code:
    java.lang.IllegalArgumentException: convertToMap - unable to convert the passed JavaScript object to a Map.  JavaScript is: {__ref: {GWT Java Obj}, COMMENTS: "foo"}
        at com.smartgwt.client.util.JSOHelper.convertToMap(JSOHelper.java:627)
        at com.smartgwt.client.util.JSOHelper.convertToMap(JSOHelper.java:639)
        at com.smartgwt.client.data.Record.toMap(Record.java:161)
        at com.isomorphic.smartgwt.examples.beans.client.BeansEntryPoint$1.execute(BeansEntryPoint.java:53)
        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.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:338)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
        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:242)
        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.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:293)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
        at java.lang.Thread.run(Thread.java:662)
    Tested in dev mode with Firefox 18 on Windoze 7. Thoughts?

    #2
    More concisely

    Code:
    public void onModuleLoad() {
    	Record foo = new Record();
    	foo.setAttribute("COMMENTS", "foo");
    	
    	Map m = foo.toMap();
    	GWT.log(String.valueOf(m.get("COMMENTS")));
    }
    Also tested on IE9. Oh, and if it wasn't clear, this remains broken as of the 2013-01-30 build.

    Comment


      #3
      Thanks for the simple test case, this is fixed for tomorrow's build.

      Comment


        #4
        JSOHelper.convertToMap also throws IllegalArgumentException after DSResponse.getError

        1. SmartClient Version: v9.1p_2014-03-23/Pro Deployment (built 2014-03-23)
        2. Browser: Internet Explorer 8.0.7601.17514
        3. Raw Response shown in RPC tab: see "Dev Console - Raw Response.txt"
        5. Stack trace: see "Dev Mode View Stack Trace.txt"
        6. Sample code: "HibernateDS.java" and "SupplyItemHibernateOperationsController.java"

        7. Error Description:
        The method "com.smartgwt.client.util.JSOHelper.convertToMap(JavaScriptObject, boolean)" throws an "IllegalArgumentException" when called by
        "com.smartgwt.client.data.DSResponse.getErrors()" if the DSResponse contains errors.

        8. How to reproduce the problem:
        In the sample project HibernateDS, replace "HibernateDS.java" and "SupplyItemHibernateOperationsController.java" by those attached.
        Then run the sample and try to delete any item in the browser.

        9. What was done:
        Hint: all changes are marked with a comment starting with "// 2014-03-25-TEST:
        a) In "HibernateDS.java", the call "boundList.removeSelectedData(...)" was modified to call "dsResponse.getErrors()"
        b) In "SupplyItemHibernateOperationsController.java", the code was modified so that the operation "DataSource.OP_REMOVE"
        always returns a DSResponse with an error status and an error message.
        Attached Files

        Comment


          #5
          A fix has been applied for this and you will see it in tonight's nightly builds of 4.1 and 5.0.

          Isomorphic

          Comment


            #6
            I have had this issue, too.
            My pleasure to confirm as fixed against SmartClient Version: v9.1p_2014-03-31/LGPL Development Only (built 2014-03-31).
            Thanks,
            MichalG

            Comment

            Working...
            X