Announcement

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

    JavaScriptException occurs when DynamicForm.saveData() invoked in GWT 2.0 dev mode

    Hi,

    We are experiencing JavaScriptException in GWT 2.0 development mode (using SmartGWT 2.0) when trying to save a form containing an array of Records (initialized via DynamicForm.setValue(String fieldName, Record[] value). Something wrong happens in DataSource.transformRequest() method, here is the stack trace:

    Code:
    com.google.gwt.core.client.JavaScriptException: (null): null 	at 
    com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:195) 	at 
    com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at 
    com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at 
    com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264) 	at 
    com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91) 	at 
    com.smartgwt.client.data.DataSource.transformRequest(DataSource.java) 	at sun.reflect.GeneratedMethodAccessor88.invoke(Unknown Source) 	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:157) 	at 
    com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) 	at 
    com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) 	at 
    com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) 	at 
    com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) 	at 
    com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284) 	at 
    com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) 	at 
    com.smartgwt.client.widgets.form.DynamicForm.saveData(DynamicForm.java)
    The same code did work in SmartGWT 1.3 and GWT 1.7. If we compile the code and run in in the production mode, the code does not throw any exception.

    Best,

    Predrag

    #2
    See the FAQ for what information to gather and post.

    Comment


      #3
      ok, here we go: example code that demonstrate the problem (using GWT 2.0 and SmartGWT 2.0) in the development mode. Please, wrap up the code in an EntryPoint class:

      Code:
              RestDataSource ds = new RestDataSource();
      	String url = "fooUrl";
      	ds.setFetchDataURL(url);
              ds.setAddDataURL(url);
              ds.setUpdateDataURL(url);
              ds.setRemoveDataURL(url);      
      	    
      	OperationBinding fetch = new OperationBinding();
              fetch.setOperationType(DSOperationType.FETCH);
              fetch.setDataProtocol(DSProtocol.GETPARAMS);
              OperationBinding add = new OperationBinding();
              add.setOperationType(DSOperationType.ADD);
              add.setDataProtocol(DSProtocol.POSTXML);
              OperationBinding update = new OperationBinding();
              update.setOperationType(DSOperationType.UPDATE);
              update.setDataProtocol(DSProtocol.POSTXML);
              OperationBinding remove = new OperationBinding();
              remove.setOperationType(DSOperationType.REMOVE);
              remove.setDataProtocol(DSProtocol.GETPARAMS);
              ds.setOperationBindings(fetch, add, update, remove);
              
      	 DataSourceTextField textField = new DataSourceTextField("foo");
      	 ds.setFields(textField);
      	 ds.setDataFormat(DSDataFormat.XML);        
               ds.setShowPrompt(false);
              
      	 DynamicForm form = new DynamicForm();
      	 form.setDataSource(ds);
      	    
      	 TextItem textItem = new TextItem();
      	 textItem.setName("foo");
      	    
      	 form.setFields(textItem);
      	    
      	 RootPanel.get().add(form);
      	   
      	 textItem.setValue("fooValue");
      	    
      	 Record record = new Record();
      	 record.setAttribute("bar", "barValue");
      	    
      	 Record record2 = new Record();
               record2.setAttribute("bar2", "barValue2");
              
      // comment out the following line for avoiding JavaScripException in GWT dev mode
      	 form.setValue("nestedRecord", new Record[] { record, record2} );
      	    
      	  try {
      	        form.saveData(new DSCallback() {
                      
                      @Override
                      public void execute(DSResponse response, Object rawData, DSRequest request) {
                          GWT.log("ok", null);
                          
                      }
                  });
      	        
      	    } catch (Exception e) {
      	        GWT.log("exception ", e);
      	    }
      The existence of the server is not important in oder to reproduce the problem.

      The exception happens before client manages to send the request to the server.
      If the line with form.setValue is commented out, the request is generated and no exception occurs.

      The code works under GWT 1.7 and SmartGWT 1.3.

      Cheers,

      Predrag

      Comment


        #4
        Are you able to reproduce the problem?

        Best,

        Predrag

        Comment


          #5
          Confirmed and fixed - will be in SVN nightlies within a couple of days.

          Comment


            #6
            Thanks a lot!

            Comment


              #7
              Not yet fixed

              Is that already part of the nightly builds? I have a similar problem with FETCH and therefore tried the provided example against revision.981 from the nightly builds, but the problem is still there with exactly the same result/exception.

              Comment


                #8
                I tested the sample against SVN and it works fine.

                Sanjiv

                Comment


                  #9
                  Thanks for testing.
                  I'm running Linux, so this might be the problem. I'll get a Windows PC and retry it there to isolate my problem.

                  Comment


                    #10
                    Fixed

                    Was not a linux issue, had the same problems with windows.
                    But the latest svn revision worked, so thanks for patching.

                    Comment

                    Working...
                    X