Announcement

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

    Exception in LegacyDevMode when start editing a new row in a empty grid

    Hi Isomorphic,

    please see this BuiltInDS testcase:

    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.SelectionStyle;
    import com.smartgwt.client.types.SortArrow;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
    import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VStack;
    import com.smartgwt.client.widgets.viewer.DetailViewer;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class BuiltInDS implements EntryPoint {
        private ListGrid boundList;
        private DynamicForm boundForm;
        private DetailViewer boundViewer;
        private IButton newBtn;
    
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            ListGrid grid = new ListGrid();
            grid.setLeft(20);
            grid.setTop(75);
            grid.setWidth(130);
            grid.setLeaveScrollbarGap(false);
            grid.setShowSortArrow(SortArrow.NONE);
            grid.setCanSort(false);
            grid.setFields(new ListGridField("dsTitle", "Select a DataSource"));
            grid.setData(new ListGridRecord[] { new DSRecord("Animals", "animals"), new DSRecord("Office Supplies", "supplyItem"),
                    new DSRecord("Employees", "employees") });
            grid.setSelectionType(SelectionStyle.SINGLE);
            grid.addRecordClickHandler(new RecordClickHandler() {
                public void onRecordClick(RecordClickEvent event) {
    
                    DSRecord record = (DSRecord) event.getRecord();
                    bindComponents(record.getDsName());
                }
            });
    
            grid.draw();
    
            VStack vStack = new VStack();
            vStack.setLeft(175);
            vStack.setTop(75);
            vStack.setWidth("70%");
            vStack.setMembersMargin(20);
    
            boundList = new ListGrid();
            boundList.setHeight(200);
            boundList.setCanEdit(true);
    
            vStack.addMember(boundList);
    
            boundForm = new DynamicForm();
            boundForm.setNumCols(6);
            boundForm.setAutoFocus(false);
            vStack.addMember(boundForm);
    
            HLayout hLayout = new HLayout(10);
            hLayout.setMembersMargin(10);
            hLayout.setHeight(22);
    
            newBtn = new AddValueToCategoryButton("New", boundList);
    
            hLayout.addMember(newBtn);
    
            vStack.addMember(hLayout);
    
            boundViewer = new DetailViewer();
            vStack.addMember(boundViewer);
    
            vStack.draw();
        }
    
        private void bindComponents(String dsName) {
            DataSource ds = DataSource.get(dsName);
            boundList.setDataSource(ds);
            boundViewer.setDataSource(ds);
            boundForm.setDataSource(ds);
            boundList.fetchData();
            newBtn.enable();
        }
    
    }
    
    class AddValueToCategoryButton extends IButton {
        private ListGrid listGrid;
    
        public AddValueToCategoryButton(final String title, final ListGrid categoryValueList) {
            super(title);
            this.listGrid = categoryValueList;
            setPrompt(title);
            setTitle(title);
            addClickHandler(new AddValueToCategoryButtonClickHandler());
        }
    
        /**
         * Start edit new record if possible
         */
        private class AddValueToCategoryButtonClickHandler implements ClickHandler {
            @Override
            public void onClick(ClickEvent event) {
                AddValueToCategoryButton.this.listGrid.startEditingNew();
            }
        }
    }
    To reproduce:
    Start debugging BuiltInDS with "GWT Legacy Development Mode with Jetty"

    1. Please empty one of the datasources you want, so that You have a empty table, I used Animals.
    2. Select the datasource you want to use from the "grid"
    3. If empty, start editing a new row by clicking the New-Button
    4. Now You should see the Exception.

    After the editing-row shows up this is the exception I get on the DevMode Console:

    13:47:36.327 [ERROR] [builtinds] Uncaught exception escaped

    com.google.gwt.core.client.JavaScriptException: (String) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object; )([JavaScript object(51149), JavaScript object(50901), JavaScript object(51150)]): Invoking an instance method on a null instance
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:252)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:121)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:573)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:293)
    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:291)
    at sun.reflect.GeneratedMethodAccessor35.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:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:341)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:222)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:121)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:573)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:315)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.smartgwt.client.widgets.grid.ListGrid.startEditingNew(ListGrid.java)
    at com.smartgwt.sample.client.AddValueToCategoryButton$AddValueToCategoryButtonClickHandler.onClick(BuiltInDS.java:129)
    at com.smartgwt.client.widgets.events.ClickEvent.dispatch(ClickEvent.java:124)
    at com.smartgwt.client.widgets.events.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 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:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:341)
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:222)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:121)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:573)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:293)
    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:291)
    at sun.reflect.GeneratedMethodAccessor35.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:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:296)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:551)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
    at java.lang.Thread.run(Unknown Source)


    If I enter then the required fields and click out of the grid for saving, this exception shows up:

    13:48:45.887 [ERROR] [builtinds] Uncaught exception escaped

    com.google.gwt.core.client.JavaScriptException: (String) @com.google.gwt.core.client.impl.Impl::apply(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object; )([JavaScript object(58376), JavaScript object(50901), JavaScript object(62387)]): Invoking an instance method on a null instance
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:252)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:121)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:573)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:293)
    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:291)
    at sun.reflect.GeneratedMethodAccessor35.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:72)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:296)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:551)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:368)
    at java.lang.Thread.run(Unknown Source)

    The record gets saved. If I then click again the New-Button neither of those exceptions appear.

    Do You know the cause of this problem?

    I'm using:
    • Win 10
    • Eclipse Java EE IDE for Web Developers, Version: Oxygen.3a Release (4.7.3a)
    • GWT 2.8.1
    • FF26.0
    • SmartClient Version: v12.0p_2019-02-14/PowerEdition Deployment (built 2019-02-14)
    Here is another issue that may be related/helpful for You:
    https://forums.smartclient.com/forum...t-mode-devmode

    Thanks in advance &
    Kind Regards




    #2
    Legacy Dev Mode is very fragile, which is why it's been deprecated in favor of SuperDevMode (see Debugging overview).

    In particular, if JavaScript code attempts a property access on a Java object in legacy dev mode, this is treated as an error and can result in bogus exceptions like the one above. This happens even though all objects are in fact JavaScript objects at runtime, so there is no actual coding error in our framework, just a flaw in legacy dev mode.

    As this is a deprecated approach in an end-of-lifed browser and does not appear to actually even break functionality, we won't be addressing this one.

    Comment


      #3
      Hi Isomorphic,

      unfortunately Legacy Dev Mode is still way more easy to use to debug for us than SuperDevMode.
      This is largely related to the fact that recompile (more specific: link step of recompile) takes very long, at least on Windows systems. This change of yours made the situation better, but still not perfect and slower for many tasks during development, that do not require a Legacy Dev Mode-restart, like e.g. smaller component configuration changes.

      Also, as far as I know, it is not possible to set and hit client side breakpoints in Eclipse directly (without a (buggy) SDBG). Of course, settings breakpoints in Chrome sourcemap does work, but this is not the place where you also do changes as well and in general step-debugging and GUI is far better in Eclipse compared to Chrome.

      Do you mean here
      Code:
      Testing with SmartGWT and GWT 2.7.0 and 2.8.x have shown that Google Chrome, Firefox 60 ESR, and IE11 all support source maps when connecting to Eclipse in Super Development
      Mode, and allow you to set breakpoints in Java source which are properly hit during execution to permit stepping. (Newer, non-ESR versions of Firefox should work as well, but (now
      unsupported) Firefox 52 ESR does not). Note that to connect to Super Development Mode remotely with source map support, you must configure Eclipse to run SDM with the -bindAddress
      argument set to your external IP. For further information, see the official overview and command-line option listing for Super Development Mode.
      that setting and hitting client side breakpoints in Eclipse does work for you also without SDBG? Or does "java source" refer to the sourcemap display in the browser?

      As these errors do not happen often (the last one exactly a year ago), it would be greatly appreciated, if you continue to support Legacy Dev Mode as long as it does not cause problems for you.

      Best regards
      Blama

      Comment


        #4
        Originally posted by Blama View Post
        Hi Isomorphic,



        Do you mean here
        Code:
        Testing with SmartGWT and GWT 2.7.0 and 2.8.x have shown that Google Chrome, Firefox 60 ESR, and IE11 all support source maps when connecting to Eclipse in Super Development
        Mode, and allow you to set breakpoints in Java source which are properly hit during execution to permit stepping. (Newer, non-ESR versions of Firefox should work as well, but (now
        unsupported) Firefox 52 ESR does not). Note that to connect to Super Development Mode remotely with source map support, you must configure Eclipse to run SDM with the -bindAddress
        argument set to your external IP. For further information, see the official overview and command-line option listing for Super Development Mode.
        that setting and hitting client side breakpoints in Eclipse does work for you also without SDBG? Or does "java source" refer to the sourcemap display in the browser?

        Best regards
        Blama
        No, the section you quoted is talking about source maps - "set breakpoints in Java" is part of the same sentence which earlier mentions "all support source maps." When running SDM, you're not going to see much in Eclipse except for build/linker output. You'll have to set your breakpoints using the browser's source map support.

        Comment


          #5
          Hi Isomorphic,

          OK, thanks. I already assumed so. Can you take a look at the Dev Mode issue anyway? It's really annoying for us and also happening seldom as issue type.

          Thank you & Best regards
          Blama

          Comment


            #6
            The Classic DevMode exceptions should be resolved back to SGWT 5.1p in the nightly builds dated 2019-02-23 and beyond.

            Comment

            Working...
            X