Announcement

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

    request.getSort() throws ex in 4.0d

    1. SmartClient Version: SNAPSHOT_v9.0d_2013-04-04/LGPL Development Only (built 2013-04-04)

    2. Firefox ESR 17.0.5

    3.

    4.

    5.java.lang.ClassCastException: java.lang.String cannot be cast to com.google.gwt.core.client.JavaScriptObject at com.smartgwt.client.util.JSOHelper.getValueFromJavaScriptObjectArray(JSOHelper.java) at com.smartgwt.client.util.JSOHelper.toArray(JSOHelper.java:131) at com.smartgwt.client.util.ConvertTo.arrayOfSortSpecifier(ConvertTo.java:7172) 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.smartgwt.client.data.DSRequest.getSortBy(DSRequest.java) at pl.com.tech4.client.MainEntryPoint$1.transformRequest(MainEntryPoint.java:31) 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.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.invokeNativeVoid(ModuleSpace.java:299) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) at com.smartgwt.client.widgets.BaseWidget.draw(BaseWidget.java) at pl.com.tech4.client.MainEntryPoint.layout(MainEntryPoint.java:54) at pl.com.tech4.client.MainEntryPoint.onModuleLoad(MainEntryPoint.java:21) 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.ModuleSpace.onLoad(ModuleSpace.java:406) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:526) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364) at java.lang.Thread.run(Thread.java:662)

    6.
    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.DOM;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.data.DataSourceField;
    import com.smartgwt.client.data.RestDataSource;
    import com.smartgwt.client.data.SortSpecifier;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.SortDirection;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.events.EditFailedEvent;
    import com.smartgwt.client.widgets.grid.events.EditFailedHandler;
    
    public class MainEntryPoint implements EntryPoint {
       
        public void onModuleLoad() {
    
            DOM.getElementById("loadingPicture").removeFromParent();
            layout();
            SC.showConsole();
        }
       
        private void layout() {
           
            final RestDataSource ds = new RestDataSource() {
    
                @Override
                protected Object transformRequest(DSRequest dsRequest) {
                    System.out.println(dsRequest.getSortBy()); //exception here
                    return super.transformRequest(dsRequest);
                }
               
            };
            ds.setDataURL("UnitDir.xml");
            DataSourceField fieldId = new DataSourceField();
            fieldId.setName("id");
            fieldId.setPrimaryKey(true);
            fieldId.setHidden(true);
            DataSourceTextField fieldCode = new DataSourceTextField();
            fieldCode.setName("code");
            ds.setFields(fieldId, fieldCode);
           
            ListGrid lg = new ListGrid();
            lg.setDataSource(ds);
            lg.setAutoFetchData(true);
            SortSpecifier sortSpecifier = new SortSpecifier("code",  SortDirection.ASCENDING);
            SortSpecifier[] sortSpecifiers = new SortSpecifier[1];
            sortSpecifiers[0] = sortSpecifier;
            lg.setSort(sortSpecifiers);
    
            lg.draw();
        }
    }
    Override transformRequest(), not able to getSort().
    MichalG

    #2
    We've checked in a fix for this in the SGWT 4.0d codestream. It should be in the next nightly build.

    Comment


      #3
      Just tested against:
      SmartClient Version: SNAPSHOT_v9.0d_2013-04-24/LGPL Development Only (built 2013-04-24)
      and the same exception occurs?
      MichalG

      Comment


        #4
        Actually, it can't really be the same stack trace, since one of the functions in the original trace is no longer called, but it may look similar.

        We were able to reproduce what we thought was the same issue with one of our internal samples, and fixed that. However, it appears like a bit more is required for your case, so now we've made that adjustment as well. It's been verified with your code that we no longer see the ClassCastException, and now hit a 404 warning from your DataSource (I'm guessing because you didn't include the xml). That addresses your original issue.

        Check the next nightly.

        Comment


          #5
          Verified as fixed in:
          SmartClient Version: SNAPSHOT_v9.0d_2013-04-28/LGPL Development Only (built 2013-04-28)
          Thank you.
          MichalG

          Comment

          Working...
          X