Announcement

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

    DataSourceField.getHidden() throws js error on field type="modifierTimestamp"

    I'm using the field type "modifierTimestamp" for the first time and I've run into a problem when checking to see if the field is marked as hidden.

    This is the data source definition.
    Code:
    <DataSource ID="BuyingAgent" dataFormat="iscServer" serverType="sql"
    	dbName="as400" sparseUpdates="true"
    	serverConstructor="com.islandpacific.gui.server.customDataSource.IpDataSource"
    	title="Buying Agent" pluralTitle="Buying Agents">
    
    	<!-- Buying agents locate, qualify and inspect foreign suppliers, negotiate 
    		with suppliers, and often monitor production for quality control and compliance 
    		with other standards. -->
    
    	<fields>
    		<field name="id" title="id" type="sequence" primaryKey="true" hidden="true"/>
    		<field name="externalId" title="External ID" type="text" length="15" required="true">
    			<validator type="isUnique" errorMessage="External ID must be unique."/>		
    		</field>
    		<field name="name" title="Name" type="text" length="40" required="true"/>
    		<field name="address1" title="Address 1" type="text" length="40" required="true"/>
    		<field name="address2" title="Address 2" type="text" length="40" />
    		<field name="city" title="City" type="text" length="40" required="true"/>
    		<field name="state" title="State" type="text" length="3" />
    		<field name="postCode" title="Postal Code" type="text" length="10" required="true"/>
    		<field name="country" title="Country" type="text" length="3" 
    			foreignKey="IPCNTRY.CCID" optionDataSource="IPCNTRY" valueField="CCID" displayField="CCNT"/>
    		<field name="agentFee" title="Agent Fee" type="float" length="7" />
    		<field name="modifiedOn" title="Modified On" type="modifierTimestamp" />
    		<field name="modifiedBy" title="Modified By" type="modifier" length="10" />	
    	</fields>
    
    </DataSource>
    I am iterating over the fields in the ds and calling getHidden() on each. When I get to the field with type="modifierTimestamp" this exception is thrown.
    Code:
    18:53:05.483 [ERROR] [ipgui] Uncaught exception escaped
    com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
        at com.smartgwt.client.core.DataClass.fireEvent(DataClass.java:248)
        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: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.GeneratedMethodAccessor49.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: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(Thread.java:680)
    Caused by: com.google.gwt.dev.shell.HostedModeException: Something other than a boolean was returned from JSNI method '@com.smartgwt.client.util.JSOHelper::getAttributeAsBoolean(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;)': JS value of type string, expected boolean
        at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:100)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java:186)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java:35)
        at com.smartgwt.client.util.JSOHelper.getAttributeAsBoolean(JSOHelper.java)
        at com.smartgwt.client.core.DataClass.getAttributeAsBoolean(DataClass.java:79)
        at com.smartgwt.client.data.DataSourceField.getHidden(DataSourceField.java:598)
        at com.islandpacific.gui.client.IpTabbedForm.createFieldGroups(IpTabbedForm.java:239)
        at com.islandpacific.gui.client.IpTabbedForm.<init>(IpTabbedForm.java:159)
        at com.islandpacific.gui.client.IpTabbedForm.<init>(IpTabbedForm.java:128)
        at com.islandpacific.gui.client.IpGenericEditor.<init>(IpGenericEditor.java:85)
        at com.islandpacific.gui.client.ConstantsDefinition.getEditTab(ConstantsDefinition.java:181)
        at com.islandpacific.gui.client.ConstantsDefinition.handleMenuSelection(ConstantsDefinition.java:127)
        at com.islandpacific.gui.client.ConstantsDefinition$2.onClick(ConstantsDefinition.java:119)
        at com.smartgwt.client.widgets.menu.events.MenuItemClickEvent.dispatch(MenuItemClickEvent.java:95)
        at com.smartgwt.client.widgets.menu.events.MenuItemClickEvent.dispatch(MenuItemClickEvent.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.smartgwt.client.core.DataClass.fireEvent(DataClass.java:248)
        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: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.GeneratedMethodAccessor49.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: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(Thread.java:680)

    #2
    Is there any way your component schema files (.ds.xml under sc/system/schema) are stale?

    If not can you show us the server response for the DataSourceLoader servlet loading this DataSource?

    Comment


      #3
      Here is the server response.
      Code:
      {
          ID:"InspectionAgent", 
          serverType:"sql", 
          fields:[
              {
                  title:"id", 
                  hidden:true, 
                  primaryKey:true, 
                  name:"id", 
                  type:"sequence"
              }, 
              {
                  title:"External ID", 
                  validator:{
                      errorMessage:"External ID must be unique.", 
                      type:"isUnique"
                  }, 
                  width:"150", 
                  name:"externalId", 
                  length:15, 
                  type:"text", 
                  required:true
              }, 
              {
                  title:"Name", 
                  width:"200", 
                  name:"name", 
                  length:40, 
                  type:"text", 
                  required:true
              }, 
              {
                  title:"Address 1", 
                  width:"200", 
                  name:"address1", 
                  length:40, 
                  type:"text", 
                  required:true
              }, 
              {
                  title:"Address 2", 
                  width:"200", 
                  name:"address2", 
                  length:40, 
                  type:"text"
              }, 
              {
                  title:"City", 
                  width:"200", 
                  name:"city", 
                  length:40, 
                  type:"text", 
                  required:true
              }, 
              {
                  title:"State", 
                  width:"54", 
                  name:"state", 
                  length:3, 
                  type:"text"
              }, 
              {
                  title:"Postal Code", 
                  width:"110", 
                  name:"postCode", 
                  length:10, 
                  type:"text", 
                  required:true
              }, 
              {
                  title:"Country", 
                  displayField:"CCNT", 
                  name:"country", 
                  valueField:"CCID", 
                  length:3, 
                  type:"text", 
                  optionDataSource:"IPCNTRY", 
                  foreignKey:"IPCNTRY.CCID"
              }, 
              {
                  title:"Agent Fee", 
                  width:"86", 
                  name:"agentFee", 
                  length:7, 
                  type:"float"
              }, 
              {
                  title:"Modified On", 
                  hidden:"true", 
                  name:"modifiedOn", 
                  canEdit:"false", 
                  type:"modifierTimestamp"
              }, 
              {
                  title:"Modified By", 
                  hidden:"true", 
                  width:"110", 
                  name:"modifiedBy", 
                  length:10, 
                  canEdit:"false", 
                  type:"modifier"
              }
          ], 
          dbName:"iptsfil4", 
          title:"Inspection Agent", 
          pluralTitle:"Inspection Agents", 
          sparseUpdates:true
      }
      DataSourceField.ds.xml in sc/system/schema does include the following.

      <!-- generic hidden flag - typically for applications or for visualBuilder -->
      <hidden type="boolean" title="Hidden" inapplicable="true" xmlAttribute="true"/>

      And the code that is failing iterates through all of the other fields without error until it gets to the modifierTimestamp field.

      I think I see the problem. The modifierTimestamp and modifier fields are being automatically tagged as hidden:"true" by the framework. But that should be hidden:true without the quotes.

      In my case I don't want them hidden anyway so I've added hidden="false" which gets around the problem.

      fyi - I updated to the latest nightly just in case, so the problem exists in SmartClient Version: SC_SNAPSHOT-2012-02-27_v8.2p/PowerEdition Deployment (built 2012-02-27)

      Comment


        #4
        Thanks, we see the problem, it will be fixed probably later this week.

        In the meantime if you wanted to detect the flag, a direct call to getAttribute() would allow you to check the String value equals("true").

        Comment

        Working...
        X