Announcement

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

    SmartGWT 4.1 DataSourceField.getType() throws exception for "number"

    Isomorphic SmartClient/SmartGWT Framework (v9.1p_2014-03-26/PowerEdition Deployment 2014-03-26)

    Moving from SmartGWT 4.0. to 4.1, I've come across an exception being thrown when calling getType() on a datasource field.

    The field in the ds.xml looks like this:
    Code:
    <field primaryKey="true" name="my_id" type="number" hidden="true"></field>
    The code on the client looks like this:
    Code:
    final DataSourceField[] dataSourceFields = dataSource.getFields();
    for ( final DataSourceField currentField : dataSourceFields ) {
     FieldType type = currentField.getType();
     
     ... snip other code ...
    }
    It looks like pre-4.1, this call would return null for a "number" fieldtype. Now it is throwing an exception.

    The call to currentField.getType() throws the following exception:
    Code:
    com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) @com.smartgwt.client.core.BaseClass::getAttributeAsString(Ljava/lang/String;)([string: 'inheritsFrom']): widget.getPropertyValue is not a function
    	at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
    	at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:487)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	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.GeneratedMethodAccessor46.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	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:724)
    Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) @com.smartgwt.client.core.BaseClass::getAttributeAsString(Ljava/lang/String;)([string: 'inheritsFrom']): widget.getPropertyValue is not a function
    	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:249)
    	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.core.BaseClass.getAttributeAsString(BaseClass.java)
    	at com.smartgwt.client.data.SimpleType.getInheritsFrom(SimpleType.java:283)
    	at com.smartgwt.client.data.DataSourceField.getType(DataSourceField.java:2698)
    This snippet from the trace log shows that 'number' is in the list of SimpleTypes from the builtinTypes.xml
    Code:
    DEBUG,03/26/2014 14:46:41:732,com.isomorphic.xml.XML,Parsed XML from __USE_CONTAINER__/app/sc/system/schema/builtinTypes.xml: 7ms,
    
    INFO,03/26/2014 14:46:41:774,com.isomorphic.pool.PoolManager,SmartClient pooling started for 'simpleTypes' objects,
    
    DEBUG,03/26/2014 14:46:41:774,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'simpleTypes',
    
    DEBUG,03/26/2014 14:46:41:814,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'Object',
    
    DEBUG,03/26/2014 14:46:41:825,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'any',
    
    DEBUG,03/26/2014 14:46:41:830,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'boolean',
    
    DEBUG,03/26/2014 14:46:41:831,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'integer',
    
    DEBUG,03/26/2014 14:46:41:832,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'float',
    
    DEBUG,03/26/2014 14:46:41:833,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'date',
    
    DEBUG,03/26/2014 14:46:41:834,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'time',
    
    DEBUG,03/26/2014 14:46:41:835,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'text',
    
    DEBUG,03/26/2014 14:46:41:836,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'string',
    
    DEBUG,03/26/2014 14:46:41:837,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'link',
    
    DEBUG,03/26/2014 14:46:41:838,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'int',
    
    DEBUG,03/26/2014 14:46:41:839,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'long',
    
    DEBUG,03/26/2014 14:46:41:840,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'number',
    
    DEBUG,03/26/2014 14:46:41:842,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'decimal',
    
    DEBUG,03/26/2014 14:46:41:844,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'double',
    
    DEBUG,03/26/2014 14:46:41:845,com.isomorphic.pool.ISCKeyedObjectPool,Borrowing object for 'dateTime',
    Should the FieldType returned be FieldType.INTEGER since "number" inherits from "integer"?

    #2
    Heh, i posted kind of exactly the same thing a couple of days ago in another thread to which i'm waiting on a reply.

    http://forums.smartclient.com/showthread.php?t=29813


    You can get around it by changing the datatype to any of the ones listed in the FieldType class.

    http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/types/FieldType.html

    that's what i had to do.

    Comment


      #3
      Just a note that this is assigned and being worked on.

      Comment


        #4
        We have a lot of datasources, so I was hoping not to have to change them all (I'm not sure what other impacts this might have).

        I see in the other thread, there was mention of clearing caches. I've tried all of that. It did not resolve the issue.

        Comment


          #5
          Originally posted by Isomorphic View Post
          Just a note that this is assigned and being worked on.
          Thanks for the update.

          Comment


            #6
            We've made a fix for this issue in SGWT 5.0d/4.1p that should be in the next nightly build.

            Comment


              #7
              I tried with the nightly build and can confirm that it now returns INTEGER as the type.

              I did notice, however, that the following warning is now displayed in the developer console:

              Code:
               
              13:02:44.767:MUP1:WARN:SimpleType:SimpleType 'number' defined twice: 
                  SimpleType.init(Obj{name:number}, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef)
                  [a]MathFunction.completeCreation(_1=>Obj{name:number}, _2=>undef, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef)
                  [c]Class.create(_1=>Obj{name:number}, _2=>undef, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef)
                  anonymous()
                  anonymous(thisObj=>com.smartgwt.client.data.SimpleType@75f62720, dispId=>1245318)
                  anonymous(property=>"inheritsFrom")
                  anonymous(thisObj=>com.smartgwt.client.widgets.menu.MenuItem@26, dispId=>1310856, p0=>An event type)
                  anonymous([TreeGrid ID:isc_GroupTreeGrid_0], Obj{title:Add Group}, [Menu ID:isc_TreeEditMenu_0], 1)
                  anonymous(jsFunction=>anonymous(), thisObj=>Obj{title:Add Group}, args=>[object Arguments])
                  anonymous(thisObj=>null, dispId=>65594, p0=>anonymous(), p1=>Obj{title:Add Group}, p2=>[object Arguments])
                  anonymous([TreeGrid ID:isc_GroupTreeGrid_0], Obj{title:Add Group}, [Menu ID:isc_TreeEditMenu_0], 1)
                  Menu.selectMenuItem(_1=>Obj{title:Add Group}, _2=>1)
                  Menu.rowClick(_1=>Obj{title:Add Group}, _2=>2, _3=>1)
                  [a]GridBody.rowClick(record=>Obj{title:Add Group}, rowNum=>2, colNum=>1)
                  GridRenderer.$29y(_1=>2, _2=>1)
                  [a]MathFunction.invokeSuper(_1=>null, _2=>"$29y", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef)
                  [a]MathFunction.Super(_1=>"$29y", _2=>[object Arguments], _3=>undef)
                  GridBody.$29y(_1=>2, _2=>1)
                  GridRenderer.click(Obj, undef)
                  Canvas.handleClick(_1=>Obj, _2=>undef)
                  [c]EventHandler.bubbleEvent(_1=>[GridBody ID:isc_TreeEditMenu_0_body], _2=>"click", _3=>undef, _4=>undef)
                  [c]EventHandler.handleClick(_1=>[GridBody ID:isc_TreeEditMenu_0_body], _2=>undef)
                  [c]EventHandler.$k5(_1=>[object MouseEvent], _2=>undef)
                  [c]EventHandler.handleMouseUp(_1=>[object MouseEvent], _2=>undef)
                  [c]EventHandler.dispatch(_1=>[c]EventHandler.handleMouseUp(), _2=>[object MouseEvent])
                  anonymous(event=>[object MouseEvent])

              Comment


                #8
                We've suppressed the warning - check the next nightlies.

                Comment

                Working...
                X