Announcement

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

    ClassCastException Error w ClickEvent

    I have some code I haven't touched in months. It worked in Dev and Production modes w/ GWT 2.3.0 and SGWTEE Eval 2.5. [Note: I originally posted as GWT 2.4.0 in error.]

    Now w/ SGWT Power 3.0p (03/26/2012 Nightly) and GWT 2.4.0 , I have this issue:

    When I click a ButtonItem "submitButton" set in a DynamicForm:
    Code:
    dynamicForm.setFields(new FormItem[] { other, formItems,andLastly,submitButton });
    This now provokes an error in an IE Window.alert:
    Code:
    Uncaught exception escaped : java.lang.ClassCastException
    Cannot cast com.smartgwt.client.widgets.form.fields.events.ClickEvent to com.smartgwt.client.event.Cancellable
    See the Development console log for details.
    Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling
    From the GWT Development Console, I see only a single [ERROR] line in the tab BuiltInDS(IE):
    Code:
    00:30:36.883 [ERROR] Uncaught exception escaped
    java.lang.ClassCastException: Cannot cast com.smartgwt.client.widgets.form.fields.events.ClickEvent to com.smartgwt.client.event.Cancellable 	at java.lang.Class.cast(Unknown Source) 	at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:163) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:57) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) 	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:213) 	at sun.reflect.GeneratedMethodAccessor99.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:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) 	at java.lang.Thread.run(Unknown Source)
    For testing, I simplified the ButtonItem's action code to only:
    Code:
    submitButton.addClickHandler(new ClickHandler() {
    
    	@Override
    	public void onClick(ClickEvent event) {
    
    		System.out.println("KERBOPPLE");
    	}
    
    });
    The System.out.println() statement does produce the output in the Eclipse log console. I.e., the ClickEvent is executing in spite of the alert.

    Nothing leaps out at me from the SmartClient console.

    Any advice appreciated, thanks.
    Last edited by tinnitus007; 27 Mar 2012, 13:34.

    #2
    There has been a recent change to this area to make form item click events cancellable (Cancelling will prevent bubbling so suppress click on the form, etc).
    However it should be entirely backwards compatible.
    We're not reproducing this from a quick test:
    Code:
    public class BackCompatBug implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            ButtonItem submitButton = new ButtonItem();
            submitButton.addClickHandler(new ClickHandler() {
    
                @Override
                public void onClick(ClickEvent event) {
    
                    System.out.println("KERBOPPLE");
                }
    
            });
            DynamicForm dynamicForm = new DynamicForm();
            dynamicForm.setFields(new FormItem[] { 
                        //other, formItems,andLastly,
                        submitButton 
                    });     
            
            dynamicForm.draw();
        }
    
    }
    If you can show us a simple standalone test case that reproduces the problem we'll take a look.
    Thanks
    Isomorphic Software

    Comment


      #3
      Here's what I see:

      I copied your code verbatim. Here are the imports used, just to be complete:
      Code:
      import com.google.gwt.core.client.EntryPoint;
      import com.smartgwt.client.widgets.form.DynamicForm;
      import com.smartgwt.client.widgets.form.fields.ButtonItem;
      import com.smartgwt.client.widgets.form.fields.FormItem;
      import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
      import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
      In GWT Development mode, I get the following alert:
      Code:
      Windows Internet Explorer
      Uncaught exception escaped : java.lang.ClassCastException
      null
      See the Development console log for details.
      Register a GWT.setUncaughtExceptionHandler(..) for custom uncaught exception handling.
      OK
      The full text from the GWT Dev console is:
      Code:
      00:07:04.559 [ERROR] Uncaught exception escaped
      java.lang.ClassCastException: null 	at java.lang.Class.cast(Unknown Source) 	at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:163) 	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:57) 	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337) 	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218) 	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136) 	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:213) 	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:172) 	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292) 	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546) 	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363) 	at java.lang.Thread.run(Unknown Source)
      I then deployed to a Tomcat server. From there, the alert does not occur. Hopefully that's a clue?

      NEW ISSUE: Possibly a related ButtonItem issue, not sure if I should post separately or here.

      In my full code, once the submit button is clicked, I disable & hide it, and put in its place a separate ButtonItem "clear" button. When the clear button is clicked, it disables & hides itself, then re-enables/shows the submit button again.

      Again, this code used to work fine with no issue. now, it provokes the following alert message:
      Code:
      Windows Internet Explorer
      Run debugger?
      
      Error:
           ''this.getClipHandle().className' is null or not an object'
           in http://127.0.0.1:8888/BuiltInDS.html?gwt.codesvr=127.0.0.1:9997
           at line 3226
      Canvas.getStateName()
      "var _1=this.getClipHandle().className;return(_1!=null?_1:this.styleName)"
      Window.flash(_1=>undef)
      callback(undefined=>undef)
           "isc_globalWarn.flash()"
      [c]Class.fireCallback(_1=>"isc_globalWarn.flash()", _2=>undef, _3=>undef, _4=>undef, _5=>undef) on [Class EventHandler]
      [c]EventHandler.$lj(_1=>Obj{ID:isc_globalWarn})
      [c]EventHandler.clickMaskClick(_1=>[ScreenSpan ID:isc_EH_screenSpan])
      [c]EventHandler.doHandleMouseDown(_1=>Obj{type:error}, _2=>undef)
      [c]EventHandler.handleMouseDown(_1=>Obj{type:error}, _2=>undef)
      [c]EventHandler.dispatch(_1=>[c]EventHandler.handleMouseDown(), _2=>Obj{type:error})
      anonymous(event=>undef)
           "if (!isc.Browser.isIE && event == null) return;var 
      returnVal=arguments.callee.$ch.isc.EH.dispatch(arguments.callee.$j2,event);return returnVal;"
      
      OK Cancel
      This error happens both in DEV and Production modes.

      IE 7.0.5730.13CO
      Chrome 18.0.1025.142 m
      GWT 2.4.0
      SmartClient Version: v8.2p_2012-03-30/PowerEdition Deployment (built 2012-03-30)

      Comment


        #4
        Just got same result in DEV w/ EE eval.

        SmartClient Version: v8.2p_2012-03-30/EVAL Deployment (expires 2012.05.29_05.29.23) Licensed to: Isomorphic Software (#ISC_EVAL_NIGHTLY)

        Comment


          #5
          SmartGwtPower 3.0 from March 25th.

          I'm getting this same exception on a ButtonItem clickHandler. Even if the onClick() function is empty, I get the exception so I know it is nothing in my code.

          Comment


            #6
            SmartGWT 3.0 Power 4/02/2012
            Same problem/error.

            I do not have the problem with SC_SNAPSHOT-2012-02-23_v8.2p/PowerEdition Deployment (built 2012-02-23)
            Last edited by lextra; 3 Apr 2012, 04:00.

            Comment


              #7
              It might be worth mentioning - despite the exception being thrown and the error appearing on screen, the event callback seems to work fine. It just makes our users start asking questions....

              Comment


                #8
                Ok we have this reproducing and we believe it is now resolved.
                Please try the next nightly build (dated April 4 or greater). If the issue continues to occur, let us know and we'll take another look

                Thanks and regards
                Isomorphic Software

                Comment


                  #9
                  Followup status:

                  With the 04/04/2012 Nightly Build of the Power edition, the ClassCastException alert no longer occurs, in either DEV or Production environments.

                  Regarding the 'this.getClipHandle().className' error, it must have been some inadvertent code change on my part. It does not occur when I go back to a fresh copy of my old last-known-good code.

                  Thanks!

                  Comment

                  Working...
                  X